1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
|
#! /bin/sh
### BEGIN INIT INFO
# Provides: mpdscribble
# Required-Start: $local_fs $remote_fs
# Required-Stop: $local_fs $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: S 0 1 6
# Short-Description: mpdscribble initscript
# Description: This script starts Music Player Daemon Audioscrobbler Client as daemon.
### END INIT INFO
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/bin/mpdscribble
NAME=mpdscribble
DESC="Music Player Daemon Audioscrobbler Client"
PIDFILE=/var/run/$NAME.pid
# user which will run this daemon
USER=mpdscribble
GROUP=mpdscribble
test -x $DAEMON || exit 0
# Include mpdscribble defaults if available
if [ -f /etc/default/mpdscribble ] ; then
. /etc/default/mpdscribble
fi
. /lib/lsb/init-functions
case "$1" in
start)
log_daemon_msg "Starting $DESC" $NAME
start-stop-daemon --chuid $USER:$GROUP --start --quiet \
--make-pidfile --pidfile $PIDFILE \
--background --exec $DAEMON -- $DAEMON_OPTS
log_end_msg $?
;;
stop)
log_daemon_msg "Stopping $DESC" $NAME
start-stop-daemon --stop --quiet --pidfile $PIDFILE \
--exec $DAEMON
RET=$?
rm -f $PIDFILE
log_end_msg $RET
;;
restart|force-reload)
sh $0 stop
sleep 1
sh $0 start
;;
*)
N=/etc/init.d/$NAME
echo "Usage: $N {start|stop|restart|force-reload}" >&2
exit 1
;;
esac
exit 0
|