Add very basic uninstall script, move install script to root directory
This commit is contained in:
parent
ec601f916c
commit
674b8c69e4
6 changed files with 59 additions and 177 deletions
|
@ -1,94 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: airtime-liquidsoap
|
||||
# Required-Start: $local_fs $remote_fs $network $syslog $all
|
||||
# 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=WEB_USER
|
||||
GROUPID=WEB_USER
|
||||
NAME="Liquidsoap Playout Engine"
|
||||
|
||||
DAEMON=/usr/lib/airtime/pypo/bin/airtime-liquidsoap
|
||||
PIDFILE=/var/run/airtime/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 \
|
||||
--startas $DAEMON --exec $EXEC
|
||||
}
|
||||
|
||||
stop () {
|
||||
timeout --version >/dev/null 2>&1
|
||||
RESULT="$?"
|
||||
|
||||
#send term signal after 10 seconds
|
||||
if [ "$RESULT" = "0" ]; then
|
||||
timeout -s9 10s /usr/lib/airtime/airtime_virtualenv/bin/python \
|
||||
/usr/lib/airtime/pypo/bin/liquidsoap_scripts/liquidsoap_prepare_terminate.py
|
||||
else
|
||||
#some earlier versions of Ubuntu (Lucid) had a different timeout
|
||||
#command that takes different input parameters.
|
||||
timeout 10 /usr/lib/airtime/airtime_virtualenv/bin/python \
|
||||
/usr/lib/airtime/pypo/bin/liquidsoap_scripts/liquidsoap_prepare_terminate.py
|
||||
fi
|
||||
# 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
|
||||
}
|
||||
|
||||
case "${1:-''}" in
|
||||
'stop')
|
||||
echo -n "Stopping $NAME: "
|
||||
stop
|
||||
echo "Done."
|
||||
;;
|
||||
'start')
|
||||
echo -n "Starting $NAME: "
|
||||
start
|
||||
echo "Done."
|
||||
;;
|
||||
'restart')
|
||||
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
|
||||
;;
|
||||
|
||||
*) # no parameter specified
|
||||
echo "Usage: $SELF start|stop|restart|status"
|
||||
exit 1
|
||||
;;
|
||||
|
||||
esac
|
|
@ -1,61 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: airtime-playout
|
||||
# Required-Start: $local_fs $remote_fs $network $syslog $all
|
||||
# Required-Stop: $local_fs $remote_fs $network $syslog
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: Manage airtime-playout daemon
|
||||
### END INIT INFO
|
||||
|
||||
USERID=WEB_USER
|
||||
NAME="Airtime Scheduler"
|
||||
|
||||
DAEMON=/usr/lib/airtime/pypo/bin/airtime-playout
|
||||
PIDFILE=/var/run/airtime/airtime-playout.pid
|
||||
|
||||
start () {
|
||||
mkdir -p /var/log/airtime/pypo
|
||||
|
||||
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.
|
||||
start-stop-daemon --stop --oknodo --retry TERM/5/0/30 --quiet --pidfile $PIDFILE
|
||||
rm -f $PIDFILE
|
||||
}
|
||||
|
||||
case "${1:-''}" in
|
||||
'start')
|
||||
# start commands here
|
||||
echo -n "Starting $NAME: "
|
||||
start
|
||||
echo "Done."
|
||||
;;
|
||||
'stop')
|
||||
# stop commands here
|
||||
echo -n "Stopping $NAME: "
|
||||
stop
|
||||
echo "Done."
|
||||
;;
|
||||
'restart')
|
||||
# restart commands here
|
||||
echo -n "Restarting $NAME: "
|
||||
stop
|
||||
start
|
||||
echo "Done."
|
||||
;;
|
||||
|
||||
'status')
|
||||
# status commands here
|
||||
/usr/bin/airtime-check-system
|
||||
;;
|
||||
*) # no parameter specified
|
||||
echo "Usage: $SELF start|stop|restart|status"
|
||||
exit 1
|
||||
;;
|
||||
|
||||
esac
|
Loading…
Add table
Add a link
Reference in a new issue