don't change monit monitor state on service start/stop
This commit is contained in:
parent
254dbafd1b
commit
0bb7fa4975
|
@ -17,19 +17,24 @@ DAEMON=/usr/lib/airtime/media-monitor/airtime-media-monitor
|
||||||
PIDFILE=/var/run/airtime-media-monitor.pid
|
PIDFILE=/var/run/airtime-media-monitor.pid
|
||||||
|
|
||||||
start () {
|
start () {
|
||||||
start-stop-daemon --start --background --quiet --chuid $USERID:$GROUPID --make-pidfile --pidfile $PIDFILE --startas $DAEMON
|
start-stop-daemon --start --background --quiet --chuid $USERID:$GROUPID \
|
||||||
monit monitor airtime-media-monitor >/dev/null 2>&1
|
--make-pidfile --pidfile $PIDFILE --startas $DAEMON
|
||||||
}
|
}
|
||||||
|
|
||||||
stop () {
|
stop () {
|
||||||
# Send TERM after 5 seconds, wait at most 30 seconds.
|
# Send TERM after 5 seconds, wait at most 30 seconds.
|
||||||
monit unmonitor airtime-media-monitor >/dev/null 2>&1
|
|
||||||
start-stop-daemon --stop --oknodo --retry TERM/5/0/30 --quiet --pidfile $PIDFILE
|
start-stop-daemon --stop --oknodo --retry TERM/5/0/30 --quiet --pidfile $PIDFILE
|
||||||
rm -f $PIDFILE
|
rm -f $PIDFILE
|
||||||
}
|
}
|
||||||
|
|
||||||
start_no_monit() {
|
start_with_monit() {
|
||||||
start-stop-daemon --start --background --quiet --chuid $USERID:$GROUPID --make-pidfile --pidfile $PIDFILE --startas $DAEMON
|
start
|
||||||
|
monit monitor airtime-media-monitor >/dev/null 2>&1
|
||||||
|
}
|
||||||
|
|
||||||
|
stop_with_monit() {
|
||||||
|
monit unmonitor airtime-media-monitor >/dev/null 2>&1
|
||||||
|
stop
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -53,10 +58,16 @@ case "${1:-''}" in
|
||||||
start
|
start
|
||||||
echo "Done."
|
echo "Done."
|
||||||
;;
|
;;
|
||||||
'start-no-monit')
|
'start-with-monit')
|
||||||
# restart commands here
|
# restart commands here
|
||||||
echo -n "Starting $NAME: "
|
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."
|
echo "Done."
|
||||||
;;
|
;;
|
||||||
'status')
|
'status')
|
||||||
|
|
|
@ -16,6 +16,6 @@ try:
|
||||||
#Start media-monitor daemon
|
#Start media-monitor daemon
|
||||||
if "airtime_service_start" in os.environ and os.environ["airtime_service_start"] == "t":
|
if "airtime_service_start" in os.environ and os.environ["airtime_service_start"] == "t":
|
||||||
print "* Waiting for media-monitor processes to start..."
|
print "* Waiting for media-monitor processes to start..."
|
||||||
subprocess.call("invoke-rc.d airtime-media-monitor start-no-monit", shell=True)
|
subprocess.call("invoke-rc.d airtime-media-monitor start", shell=True)
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
print e
|
print e
|
||||||
|
|
|
@ -17,22 +17,6 @@ DAEMON=/usr/lib/airtime/pypo/bin/airtime-liquidsoap
|
||||||
PIDFILE=/var/run/airtime-liquidsoap.pid
|
PIDFILE=/var/run/airtime-liquidsoap.pid
|
||||||
|
|
||||||
start () {
|
start () {
|
||||||
start_no_monit
|
|
||||||
monit monitor airtime-liquidsoap >/dev/null 2>&1
|
|
||||||
}
|
|
||||||
|
|
||||||
stop () {
|
|
||||||
monit unmonitor airtime-liquidsoap >/dev/null 2>&1
|
|
||||||
#send term signal after 10 seconds
|
|
||||||
timeout -k 5 10 /usr/lib/airtime/airtime_virtualenv/bin/python \
|
|
||||||
/usr/lib/airtime/pypo/bin/liquidsoap_scripts/liquidsoap_prepare_terminate.py
|
|
||||||
# Send TERM after 5 seconds, wait at most 30 seconds.
|
|
||||||
start-stop-daemon --stop --oknodo --retry=TERM/10/KILL/5 --quiet --pidfile $PIDFILE
|
|
||||||
rm -f $PIDFILE
|
|
||||||
sleep 3
|
|
||||||
}
|
|
||||||
|
|
||||||
start_no_monit() {
|
|
||||||
chown pypo:pypo /var/log/airtime/pypo
|
chown pypo:pypo /var/log/airtime/pypo
|
||||||
chown pypo:pypo /var/log/airtime/pypo-liquidsoap
|
chown pypo:pypo /var/log/airtime/pypo-liquidsoap
|
||||||
chown pypo:pypo /etc/airtime/liquidsoap.cfg
|
chown pypo:pypo /etc/airtime/liquidsoap.cfg
|
||||||
|
@ -45,21 +29,43 @@ start_no_monit() {
|
||||||
--pidfile $PIDFILE --nicelevel -15 --startas $DAEMON
|
--pidfile $PIDFILE --nicelevel -15 --startas $DAEMON
|
||||||
}
|
}
|
||||||
|
|
||||||
|
stop () {
|
||||||
|
#send term signal after 10 seconds
|
||||||
|
timeout -k 5 10 /usr/lib/airtime/airtime_virtualenv/bin/python \
|
||||||
|
/usr/lib/airtime/pypo/bin/liquidsoap_scripts/liquidsoap_prepare_terminate.py
|
||||||
|
# Send TERM after 5 seconds, wait at most 30 seconds.
|
||||||
|
start-stop-daemon --stop --oknodo --retry=TERM/10/KILL/5 --quiet --pidfile $PIDFILE
|
||||||
|
rm -f $PIDFILE
|
||||||
|
sleep 3
|
||||||
|
}
|
||||||
|
|
||||||
|
start_with_monit () {
|
||||||
|
start
|
||||||
|
monit monitor airtime-liquidsoap >/dev/null 2>&1
|
||||||
|
}
|
||||||
|
|
||||||
|
stop_with_monit() {
|
||||||
|
monit unmonitor airtime-liquidsoap >/dev/null 2>&1
|
||||||
|
stop
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
case "${1:-''}" in
|
case "${1:-''}" in
|
||||||
'stop')
|
'stop')
|
||||||
echo -n "Stopping Liquidsoap: "
|
echo -n "Stopping $NAME: "
|
||||||
stop
|
stop
|
||||||
echo "Done."
|
echo "Done."
|
||||||
;;
|
;;
|
||||||
'start')
|
'start')
|
||||||
echo -n "Starting Liquidsoap: "
|
echo -n "Starting $NAME: "
|
||||||
start
|
start
|
||||||
echo "Done."
|
echo "Done."
|
||||||
;;
|
;;
|
||||||
'restart')
|
'restart')
|
||||||
# restart commands here
|
# restart commands here
|
||||||
echo -n "Restarting Liquidsoap: "
|
echo -n "Restarting $NAME: "
|
||||||
stop
|
stop
|
||||||
start
|
start
|
||||||
echo "Done."
|
echo "Done."
|
||||||
|
@ -69,22 +75,28 @@ case "${1:-''}" in
|
||||||
if [ -f "$PIDFILE" ]; then
|
if [ -f "$PIDFILE" ]; then
|
||||||
pid=`cat $PIDFILE`
|
pid=`cat $PIDFILE`
|
||||||
if [ -d "/proc/$pid" ]; then
|
if [ -d "/proc/$pid" ]; then
|
||||||
echo "Liquidsoap is running"
|
echo "$NAME is running"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
echo "Liquidsoap is not running"
|
echo "$NAME is not running"
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
'start-no-monit')
|
'start-with-monit')
|
||||||
# restart commands here
|
# restart commands here
|
||||||
echo -n "Starting $NAME: "
|
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."
|
echo "Done."
|
||||||
;;
|
;;
|
||||||
|
|
||||||
*) # no parameter specified
|
*) # no parameter specified
|
||||||
echo "Usage: $SELF start|stop|restart"
|
echo "Usage: $SELF start|stop|restart|status"
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
### END INIT INFO
|
### END INIT INFO
|
||||||
|
|
||||||
USERID=root
|
USERID=root
|
||||||
NAME="Airtime Scheduler Engine"
|
NAME="Airtime Scheduler"
|
||||||
|
|
||||||
DAEMON=/usr/lib/airtime/pypo/bin/airtime-playout
|
DAEMON=/usr/lib/airtime/pypo/bin/airtime-playout
|
||||||
PIDFILE=/var/run/airtime-playout.pid
|
PIDFILE=/var/run/airtime-playout.pid
|
||||||
|
@ -18,21 +18,24 @@ PIDFILE=/var/run/airtime-playout.pid
|
||||||
start () {
|
start () {
|
||||||
chown pypo:pypo /etc/airtime
|
chown pypo:pypo /etc/airtime
|
||||||
chown pypo:pypo /etc/airtime/liquidsoap.cfg
|
chown pypo:pypo /etc/airtime/liquidsoap.cfg
|
||||||
|
start-stop-daemon --start --background --quiet --chuid $USERID:$USERID \
|
||||||
start-stop-daemon --start --background --quiet --chuid $USERID:$USERID --make-pidfile --pidfile $PIDFILE --startas $DAEMON
|
--make-pidfile --pidfile $PIDFILE --startas $DAEMON
|
||||||
monit monitor airtime-playout >/dev/null 2>&1
|
|
||||||
}
|
}
|
||||||
|
|
||||||
stop () {
|
stop () {
|
||||||
# Send TERM after 5 seconds, wait at most 30 seconds.
|
# 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
|
start-stop-daemon --stop --oknodo --retry TERM/5/0/30 --quiet --pidfile $PIDFILE
|
||||||
rm -f $PIDFILE
|
rm -f $PIDFILE
|
||||||
}
|
}
|
||||||
|
|
||||||
start_no_monit() {
|
start_with_monit() {
|
||||||
start-stop-daemon --start --background --quiet --chuid $USERID:$USERID --make-pidfile --pidfile $PIDFILE --startas $DAEMON
|
start
|
||||||
|
monit monitor airtime-playout >/dev/null 2>&1
|
||||||
|
}
|
||||||
|
|
||||||
|
stop_with_monit() {
|
||||||
|
monit unmonitor airtime-playout >/dev/null 2>&1
|
||||||
|
stop
|
||||||
}
|
}
|
||||||
|
|
||||||
case "${1:-''}" in
|
case "${1:-''}" in
|
||||||
|
@ -55,12 +58,19 @@ case "${1:-''}" in
|
||||||
start
|
start
|
||||||
echo "Done."
|
echo "Done."
|
||||||
;;
|
;;
|
||||||
'start-no-monit')
|
'start-with-monit')
|
||||||
# restart commands here
|
# restart commands here
|
||||||
echo -n "Starting $NAME: "
|
echo -n "Starting $NAME: "
|
||||||
start_no_monit
|
start_with_monit
|
||||||
echo "Done."
|
echo "Done."
|
||||||
;;
|
;;
|
||||||
|
'stop-with-monit')
|
||||||
|
# restart commands here
|
||||||
|
echo -n "Stopping $NAME: "
|
||||||
|
stop_with_monit
|
||||||
|
echo "Done."
|
||||||
|
;;
|
||||||
|
|
||||||
'status')
|
'status')
|
||||||
# status commands here
|
# status commands here
|
||||||
/usr/bin/airtime-check-system
|
/usr/bin/airtime-check-system
|
||||||
|
|
|
@ -88,8 +88,8 @@ try:
|
||||||
|
|
||||||
if "airtime_service_start" in os.environ and os.environ["airtime_service_start"] == "t":
|
if "airtime_service_start" in os.environ and os.environ["airtime_service_start"] == "t":
|
||||||
print "* Waiting for pypo processes to start..."
|
print "* Waiting for pypo processes to start..."
|
||||||
subprocess.call("invoke-rc.d airtime-playout start-no-monit > /dev/null 2>&1", shell=True)
|
subprocess.call("invoke-rc.d airtime-playout start > /dev/null 2>&1", shell=True)
|
||||||
subprocess.call("invoke-rc.d airtime-liquidsoap start-no-monit > /dev/null 2>&1", shell=True)
|
subprocess.call("invoke-rc.d airtime-liquidsoap start > /dev/null 2>&1", shell=True)
|
||||||
|
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
print e
|
print e
|
||||||
|
|
Loading…
Reference in New Issue