cc-2055: switch to init.d
-disable daemon from starting twice
This commit is contained in:
parent
b0befdff20
commit
5803635d50
7 changed files with 91 additions and 84 deletions
51
python_apps/pypo/airtime-pypo-init-d
Executable file
51
python_apps/pypo/airtime-pypo-init-d
Executable file
|
@ -0,0 +1,51 @@
|
|||
#!/bin/bash
|
||||
|
||||
USERID=pypo
|
||||
GROUPID=pypo
|
||||
ENABLE="false"
|
||||
NAME=Airtime
|
||||
ID=airtime
|
||||
|
||||
DAEMON=/usr/bin/airtime-pypo
|
||||
PIDFILE=/var/run/$ID.pid
|
||||
|
||||
start () {
|
||||
start-stop-daemon --start --background --quiet --chuid $USERID:$GROUPID --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 $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