Major reorganization of the pypo directory.
Much better organization of files into packages
This commit is contained in:
parent
f4d313a67c
commit
1c87d51b8e
20 changed files with 16 additions and 15 deletions
|
@ -1,116 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: airtime-liquidsoap
|
||||
# Required-Start: $local_fs $remote_fs $network $syslog
|
||||
# Required-Stop: $local_fs $remote_fs $network $syslog
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: Liquidsoap daemon
|
||||
### END INIT INFO
|
||||
|
||||
USERID=pypo
|
||||
GROUPID=pypo
|
||||
NAME="Liquidsoap Playout Engine"
|
||||
|
||||
DAEMON=/usr/lib/airtime/pypo/bin/airtime-liquidsoap
|
||||
PIDFILE=/var/run/airtime-liquidsoap.pid
|
||||
EXEC='/usr/bin/airtime-liquidsoap'
|
||||
|
||||
start () {
|
||||
|
||||
mkdir -p /var/log/airtime/pypo-liquidsoap
|
||||
chown $USERID:$GROUPID /var/log/airtime/pypo-liquidsoap
|
||||
|
||||
chown $USERID:$GROUPID /etc/airtime
|
||||
touch /etc/airtime/liquidsoap.cfg
|
||||
chown $USERID:$GROUPID /etc/airtime/liquidsoap.cfg
|
||||
|
||||
touch $PIDFILE
|
||||
chown $USERID:$GROUPID $PIDFILE
|
||||
|
||||
#start-stop-daemon --start --quiet --chuid $USERID:$GROUPID \
|
||||
#--pidfile $PIDFILE --nicelevel -15 --startas $DAEMON
|
||||
start-stop-daemon --start --quiet --chuid $USERID:$GROUPID \
|
||||
--nicelevel -15 --startas $DAEMON --exec $EXEC
|
||||
}
|
||||
|
||||
stop () {
|
||||
#send term signal after 10 seconds
|
||||
timeout -s9 10s /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
|
||||
start-stop-daemon --stop --oknodo --retry=TERM/10/KILL/5 --quiet --exec $EXEC
|
||||
|
||||
rm -f $PIDFILE
|
||||
sleep 2
|
||||
}
|
||||
|
||||
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
|
||||
'stop')
|
||||
echo "* Stopping Liquidsoap without notifying Monit process watchdog. If Monit is
|
||||
* running it will automatically bring the Liquidsoap back up. You probably want
|
||||
* 'stop-with-monit' instead of 'stop'."
|
||||
echo -n "Stopping $NAME: "
|
||||
stop
|
||||
echo "Done."
|
||||
;;
|
||||
'start')
|
||||
echo "* Starting $NAME without Monit process watchdog. To make sure Monit is watching
|
||||
* Liquidsoap, use 'start-with-monit' instead of 'start'."
|
||||
echo -n "Starting $NAME: "
|
||||
start
|
||||
echo "Done."
|
||||
;;
|
||||
'restart')
|
||||
# restart commands here
|
||||
echo -n "Restarting $NAME: "
|
||||
stop
|
||||
start
|
||||
echo "Done."
|
||||
;;
|
||||
|
||||
'status')
|
||||
if [ -f "$PIDFILE" ]; then
|
||||
pid=`cat $PIDFILE`
|
||||
if [ -d "/proc/$pid" ]; then
|
||||
echo "$NAME is running"
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
echo "$NAME is not running"
|
||||
exit 1
|
||||
;;
|
||||
'start-with-monit')
|
||||
# restart commands here
|
||||
echo -n "Starting $NAME: "
|
||||
start_with_monit
|
||||
echo "Done."
|
||||
;;
|
||||
'stop-with-monit')
|
||||
# restart commands here
|
||||
echo -n "Stopping $NAME: "
|
||||
stop_with_monit
|
||||
echo "Done."
|
||||
;;
|
||||
|
||||
*) # no parameter specified
|
||||
echo "Usage: $SELF start|stop|restart|status"
|
||||
exit 1
|
||||
;;
|
||||
|
||||
esac
|
Loading…
Add table
Add a link
Reference in a new issue