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
start program = "/usr/local/bin/postsrsd"
stop program = "/bin/sh -c 'cat /tmp/postsrsd.pid | xargs -r kill'"
check process postsrsd with pidfile /run/postsrsd/postsrsd.pid
start program = "/usr/local/bin/postsrsd start"
stop program = "/usr/local/bin/postsrsd stop"
if failed port 10001 for 3 cycles then restart
if failed port 10002 for 3 cycles then restart

View File

@ -1,17 +1,18 @@
#!/bin/sh
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)
test -f "${SRS_PID_FILE}" && cat /tmp/postsrsd.pid | xargs -r kill
exit $?
test ! -f "${SRS_PID_FILE}" || cat "${SRS_PID_FILE}" | xargs -r kill
;;
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