3 # skeleton example file to build /etc/init.d/ scripts.
4 # This file should be used to construct scripts for /etc/init.d.
6 # Written by Miquel van Smoorenburg <miquels@cistron.nl>.
8 # by Ian Murdock <imurdock@gnu.ai.mit.edu>.
10 # Version: @(#)skeleton 1.9 26-Feb-2001 miquels@cistron.nl
13 PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
14 DAEMON=/usr/sbin/headphoned
17 DESC="Headphone daemon"
19 # XXX: The following is needed for the D-Bus connection to work
20 export DBUS_SESSION_BUS_ADDRESS='unix:path=/tmp/session_bus_socket'
23 # Add the headphoned FIFO to MPlayer's global configuration
24 CONFIG_LINE="input:file=/etc/headphoned/mplayer-input"
25 MPLAYER_CONF="/etc/mplayer/mplayer.conf"
26 if [ -f "$MPLAYER_CONF" ]; then
27 if ! grep "$CONFIG_LINE" "$MPLAYER_CONF" >/dev/null; then
28 echo -n "Updating $MPLAYER_CONF... "
29 echo $CONFIG_LINE >>$MPLAYER_CONF
33 # End Add the headphoned FIFO to MPlayer's global configuration
35 test -x $DAEMON || exit 0
41 echo -n "Starting $DESC: "
42 start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid \
43 -b --user $USER --chuid $USER --exec $DAEMON -- $DAEMON_OPTS
47 echo -n "Stopping $DESC: "
48 _PIDS=`pidof $DAEMON || echo ""`
49 if [ "$_PIDS" != "" ]; then
52 #start-stop-daemon --stop --quiet --pidfile /var/run/$NAME.pid \
53 # --user $USER --chuid $USER --exec $DAEMON
58 # If the daemon can reload its config files on the fly
59 # for example by sending it SIGHUP, do it here.
61 # If the daemon responds to changes in its config file
62 # directly anyway, make this a do-nothing entry.
64 # echo "Reloading $DESC configuration files."
65 # start-stop-daemon --stop --signal 1 --quiet --pidfile \
66 # /var/run/$NAME.pid --exec $DAEMON
70 # If the "reload" option is implemented, move the "force-reload"
71 # option to the "reload" entry above. If not, "force-reload" is
72 # just the same as "restart" except that it does nothing if the
73 # daemon isn't already running.
74 # check wether $DAEMON is running. If so, restart
75 #start-stop-daemon --stop --test --quiet --pidfile \
76 # --user $USER --chuid $USER /var/run/$NAME.pid --exec $DAEMON \
81 echo -n "Restarting $DESC: "
82 _PIDS=`pidof $DAEMON || echo ""`
83 if [ "$_PIDS" != "" ]; then
86 #start-stop-daemon --stop --quiet --pidfile \
87 # --user $USER --chuid $USER /var/run/$NAME.pid --exec $DAEMON
89 start-stop-daemon --start --quiet --pidfile -b --user $USER \
90 --chuid $USER /var/run/$NAME.pid --exec $DAEMON -- $DAEMON_OPTS
95 # echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
96 echo "Usage: $N {start|stop|restart|force-reload}" >&2