4
# Provides: forked-daapd
5
# Required-Start: $local_fs $remote_fs $network $time avahi
6
# Required-Stop: $local_fs $remote_fs $network $time
7
# Default-Start: 2 3 4 5
9
# Short-Description: media server with support for RSP, DAAP, DACP and AirTunes
10
# Description: forked-daapd is an iTunes-compatible media server for
11
# sharing your music library over the local network with RSP
12
# clients like the SoundBridge from Roku and DAAP clients like
13
# iTunes. It can also stream music to AirTunes devices.
16
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
17
DAEMON=/usr/sbin/forked-daapd
19
DESC="RSP and DAAP media server"
21
test -x $DAEMON || exit 0
23
PIDFILE=/var/run/$NAME.pid
29
# Check if a given process pid's cmdline matches a given name
32
[ -z "$pid" ] && return 1
33
[ ! -d /proc/$pid ] && return 1
34
cmd=`cat /proc/$pid/cmdline | tr "\000" "\n"|head -n 1 |cut -d : -f 1`
35
# Is this the expected child?
36
[ "$cmd" != "$name" ] && return 1
42
# Check if the process is running looking at /proc
43
# (works for all users)
45
# No pidfile, probably no daemon present
46
[ ! -f "$PIDFILE" ] && return 1
47
# Obtain the pid and check it against the binary name
49
running_pid $pid $DAEMON || return 1
54
# Forcefully kill the process
55
[ ! -f "$PIDFILE" ] && return
62
echo "Cannot kill $NAME (pid=$pid)!"
73
echo -n "Starting $DESC: "
74
start-stop-daemon --start --quiet --pidfile $PIDFILE \
75
--exec $DAEMON -- $DAEMON_OPTS
83
echo -n "Stopping $DESC: "
84
start-stop-daemon --oknodo --stop --quiet --pidfile $PIDFILE \
89
start-stop-daemon --stop --test --quiet --pidfile \
90
/var/run/$NAME.pid --exec $DAEMON \
95
echo -n "Restarting $DESC: "
96
start-stop-daemon --stop --quiet --pidfile \
97
/var/run/$NAME.pid --exec $DAEMON
98
start-stop-daemon --start --quiet --pidfile \
99
/var/run/$NAME.pid --exec $DAEMON -- $DAEMON_OPTS
113
echo "Usage: $N {start|stop|restart|force-reload|status}" >&2