4 # Required-Start: $local_fs $mpd
5 # Required-Stop: $local_fs $mpd
6 # Default-Start: 2 3 4 5
8 # Short-Description: Daemonized version of ympd.
9 # Description: Enable service provided by ympd.
11 #Author: Andrew Karpow <andy@ndyk.de>
13 . /lib/lsb/init-functions
15 PATH=/sbin:/usr/sbin:/bin:/usr/bin
19 PIDFILE=/var/run/$NAME.pid
20 SCRIPTNAME=/etc/init.d/$NAME
21 LOG_OUT=/var/log/$NAME.out
22 LOG_ERR=/var/log/$NAME.err
24 DAEMON_OPT="--user $YMPD_USER --webport 80"
26 # Exit if the package is not installed
27 [ -x "$DAEMON" ] || exit 0
29 # Read configuration variable file if it is present
30 [ -r /etc/default/$NAME ] && . /etc/default/$NAME
32 # Load the VERBOSE setting and other rcS variables
33 [ -f /etc/default/rcS ] && . /etc/default/rcS
37 start-stop-daemon --start --background --quiet --pidfile $PIDFILE --make-pidfile \
38 --exec $DAEMON --test > /dev/null || return 1
39 start-stop-daemon --start --background --quiet --pidfile $PIDFILE --make-pidfile \
40 --exec $DAEMON -- $DAEMON_OPT || return 2
45 start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
48 [ "$RETVAL" = 2 ] && return 2
55 [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
58 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
59 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
63 [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
66 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
67 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
71 status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
75 # If the "reload" option is implemented then remove the
76 # 'force-reload' alias
78 log_daemon_msg "Restarting $DESC" "$NAME"
85 1) log_end_msg 1 ;; # Old process is still running
86 *) log_end_msg 1 ;; # Failed to start
96 echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2