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 60 61 62 63 64 65 66 67
|
#! /bin/sh
### BEGIN INIT INFO
# Provides: mpdscribble
# Required-Start: $local_fs $remote_fs
# Required-Stop: $local_fs $remote_fs
# Should-Start: mpd
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: mpdscribble initscript
# Description: This script starts Music Player Daemon Last.fm 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 Last.fm 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)
if [ ! "x$MPD_SYSTEMWIDE" = x1 ]; then
log_warning_msg "Not starting $DESC, disabled via /etc/default/mpdscribble"
exit 0
fi
log_daemon_msg "Starting $DESC" $NAME
start-stop-daemon --start --quiet \
--pidfile $PIDFILE --background --exec $DAEMON -- \
--daemon-user $USER --pidfile $PIDFILE $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
;;
status)
status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
;;
*)
N=/etc/init.d/$NAME
echo "Usage: $N {start|stop|restart|force-reload}" >&2
exit 1
;;
esac
exit 0
|