Skip to content
Snippets Groups Projects
Commit ceaf23cf authored by ale's avatar ale
Browse files

add an init script to run djrandom-client as daemon with the debian package

parent dea4ce63
No related branches found
No related tags found
No related merge requests found
djrandom-client (0.2.7-1) unstable; urgency=low
* Add an init script to run it as a daemon.
-- ale <ale@incal.net> Sun, 25 Feb 2012 00:59:43 +0000
djrandom-client (0.2.7) unstable; urgency=low
* Add --exclude option.
......
......@@ -8,7 +8,7 @@ Standards-Version: 3.8.0.1
Package: djrandom-client
Architecture: all
Depends: ${python:Depends}, python-pyinotify
Depends: ${python:Depends}
Description: DJRandom uploader client.
Uploads your music in the background.
# Set this to 'true' to enable the daemon.
ENABLED=false
#!/bin/bash
#
# Start/stop the DJRandom client.
#
### BEGIN INIT INFO
# Provides: djrandom
# Required-Start: $network $local_fs
# Required-Stop:
# Should-Start:
# Should-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: DJRandom Client
# Description: DJRandom Client
### END INIT INFO
NAME=djrandom-client
DESCR="DJRandom client"
DAEMON=/usr/bin/djrandom-client
RUNDIR=/var/run/djrandom
PIDFILE=${RUNDIR}/${NAME}.pid
USER=nobody
OPTIONS=
ENABLED=false
test -e /etc/default/${NAME} && . /etc/default/${NAME}
test -x ${DAEMON} || exit 0
if [ "${ENABLED}" != "true" ]; then
echo "DJRandom will not start as a daemon."
echo "Set ENABLED=true in /etc/default/${NAME} to enable."
exit 0
fi
case "$1" in
start)
test -d ${RUNDIR} || mkdir -p ${RUNDIR}
if [ -n "${USER}" ]; then
chown ${USER} ${RUNDIR}
OPTIONS="--user ${USER} ${OPTIONS}"
fi
OPTIONS="--skip_version_check ${OPTIONS}"
echo -n "Starting ${DESCR}... "
start-stop-daemon --start --pidfile ${PIDFILE} \
--exec ${DAEMON} -- ${OPTIONS}
echo "ok"
;;
stop)
echo -n "Stopping ${DESCR}... "
start-stop-daemon --stop \
--pidfile ${PIDFILE} && rm -f ${PIDFILE}
echo "ok"
;;
restart)
$0 stop
sleep 3
$0 start
;;
esac
exit 0
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment