diff options
Diffstat (limited to 'community/mpd/mpd.initd')
-rw-r--r-- | community/mpd/mpd.initd | 46 |
1 files changed, 11 insertions, 35 deletions
diff --git a/community/mpd/mpd.initd b/community/mpd/mpd.initd index c92bb982a6..8cb2c6aa17 100644 --- a/community/mpd/mpd.initd +++ b/community/mpd/mpd.initd @@ -2,9 +2,16 @@ # init.d file for music player daemon -NAME=mpd -DAEMON=/usr/bin/$NAME -CONF=/etc/mpd.conf +supervisor=supervise-daemon + +name="Music Player Daemon" +description="A daemon for playing music" + +commmand=/usr/bin/mpd +command_args="$MPD_OPTS" +command_args_foreground="--no-daemon" + +command_user="${M_USER:-mpd}:${M_GROUP:-audio}" depend() { need localmount @@ -12,37 +19,6 @@ depend() { after firewall } -checkconfig() { - [ -f "$CONF" ] && return 0 - eerror "configuration file $CONF is missing" - return 1 -} - -get_pidfile() { - pidfile=$(awk '$1 == "pid_file" { print $2 }' "$CONF" | sed 's/"//') - pidfile=${pidfile:-/var/run/mpd/$NAME.pid} -} - -start() { - checkconfig || return 1 - get_pidfile - checkpath --owner ${M_USER:-mpd}:${M_GROUP:-audio} \ - --directory ${pidfile%/*} - - ebegin "Starting ${NAME}" - start-stop-daemon --start --quiet \ - --exec ${DAEMON} -- ${MPD_OPTS} - eend $? -} - -stop() { - get_pidfile - ebegin "Stopping ${NAME}" - mpd --kill - eend $? -} - start_pre() { - checkpath --directory --owner ${M_USER:-mpd} \ - --mode 0775 /var/run/$NAME + checkpath --directory --owner "${M_USER:-mpd}" --mode 0775 /var/run/mpd } |