This commit is contained in:
f 2022-03-15 20:03:52 -03:00
parent 6c2e64f5cf
commit 9e6813a994
2 changed files with 14 additions and 13 deletions

View file

@ -1,6 +1,6 @@
check process postsrsd with pidfile /tmp/postsrsd.pid check process postsrsd with pidfile /run/postsrsd/postsrsd.pid
start program = "/usr/local/bin/postsrsd" start program = "/usr/local/bin/postsrsd start"
stop program = "/bin/sh -c 'cat /tmp/postsrsd.pid | xargs -r kill'" stop program = "/usr/local/bin/postsrsd stop"
if failed port 10001 for 3 cycles then restart if failed port 10001 for 3 cycles then restart
if failed port 10002 for 3 cycles then restart if failed port 10002 for 3 cycles then restart

View file

@ -1,17 +1,18 @@
#!/bin/sh #!/bin/sh
set -e set -e
export SRS_PID_FILE=/tmp/postsrsd.pid export SRS_PID_FILE=/run/postsrsd/postsrsd.pid
case "$1" in case $1 in
start)
test -n "${SRS_DOMAIN}"
test -n "${SRS_SECRET}"
test -f "${SRS_SECRET}" || dd if=/dev/urandom bs=18 count=1 status=none | base64 > "${SRS_SECRET}"
install -dm 750 -u postsrsd -g postsrsd "${SRS_PID_FILE%/.*}"
/usr/sbin/postsrsd -e -D -u postsrsd -l ::
;;
stop) stop)
test -f "${SRS_PID_FILE}" && cat /tmp/postsrsd.pid | xargs -r kill test ! -f "${SRS_PID_FILE}" || cat "${SRS_PID_FILE}" | xargs -r kill
exit $?
;; ;;
esac esac
test -n "${SRS_DOMAIN}"
test -n "${SRS_SECRET}"
test -f "${SRS_SECRET}" || dd if=/dev/urandom bs=18 count=1 status=none | base64 > "${SRS_SECRET}"
/usr/sbin/postsrsd -e -D -l 0.0.0.0 -u postsrsd -4