don't change monit monitor state on service start/stop
This commit is contained in:
parent
5ac51e289d
commit
811abc4baf
5 changed files with 77 additions and 44 deletions
|
@ -10,7 +10,7 @@
|
|||
### END INIT INFO
|
||||
|
||||
USERID=root
|
||||
NAME="Airtime Scheduler Engine"
|
||||
NAME="Airtime Scheduler"
|
||||
|
||||
DAEMON=/usr/lib/airtime/pypo/bin/airtime-playout
|
||||
PIDFILE=/var/run/airtime-playout.pid
|
||||
|
@ -18,21 +18,24 @@ PIDFILE=/var/run/airtime-playout.pid
|
|||
start () {
|
||||
chown pypo:pypo /etc/airtime
|
||||
chown pypo:pypo /etc/airtime/liquidsoap.cfg
|
||||
|
||||
start-stop-daemon --start --background --quiet --chuid $USERID:$USERID --make-pidfile --pidfile $PIDFILE --startas $DAEMON
|
||||
monit monitor airtime-playout >/dev/null 2>&1
|
||||
start-stop-daemon --start --background --quiet --chuid $USERID:$USERID \
|
||||
--make-pidfile --pidfile $PIDFILE --startas $DAEMON
|
||||
}
|
||||
|
||||
stop () {
|
||||
# Send TERM after 5 seconds, wait at most 30 seconds.
|
||||
|
||||
monit unmonitor airtime-playout >/dev/null 2>&1
|
||||
start-stop-daemon --stop --oknodo --retry TERM/5/0/30 --quiet --pidfile $PIDFILE
|
||||
rm -f $PIDFILE
|
||||
}
|
||||
|
||||
start_no_monit() {
|
||||
start-stop-daemon --start --background --quiet --chuid $USERID:$USERID --make-pidfile --pidfile $PIDFILE --startas $DAEMON
|
||||
start_with_monit() {
|
||||
start
|
||||
monit monitor airtime-playout >/dev/null 2>&1
|
||||
}
|
||||
|
||||
stop_with_monit() {
|
||||
monit unmonitor airtime-playout >/dev/null 2>&1
|
||||
stop
|
||||
}
|
||||
|
||||
case "${1:-''}" in
|
||||
|
@ -55,12 +58,19 @@ case "${1:-''}" in
|
|||
start
|
||||
echo "Done."
|
||||
;;
|
||||
'start-no-monit')
|
||||
'start-with-monit')
|
||||
# restart commands here
|
||||
echo -n "Starting $NAME: "
|
||||
start_no_monit
|
||||
start_with_monit
|
||||
echo "Done."
|
||||
;;
|
||||
'stop-with-monit')
|
||||
# restart commands here
|
||||
echo -n "Stopping $NAME: "
|
||||
stop_with_monit
|
||||
echo "Done."
|
||||
;;
|
||||
|
||||
'status')
|
||||
# status commands here
|
||||
/usr/bin/airtime-check-system
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue