aboutsummaryrefslogtreecommitdiffstats
path: root/testing/mpd/mpd.initd
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2009-09-10 09:04:06 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2009-09-10 09:07:14 +0000
commit868e4cbd62215412630b50ba8fa82a81d55edca0 (patch)
tree655ef50c27e66467dfd1643c06539830d8ffab98 /testing/mpd/mpd.initd
parent08a789230fb36d32a10b92ecbf12d8ec55c5e4a6 (diff)
downloadaports-868e4cbd62215412630b50ba8fa82a81d55edca0.tar.gz
aports-868e4cbd62215412630b50ba8fa82a81d55edca0.tar.bz2
aports-868e4cbd62215412630b50ba8fa82a81d55edca0.tar.xz
testing/mpd: new aport
Music daemon that plays MP3, FLAC, and Ogg Vorbis files http://musicpd.org
Diffstat (limited to 'testing/mpd/mpd.initd')
-rw-r--r--testing/mpd/mpd.initd43
1 files changed, 43 insertions, 0 deletions
diff --git a/testing/mpd/mpd.initd b/testing/mpd/mpd.initd
new file mode 100644
index 0000000000..7601ed4f27
--- /dev/null
+++ b/testing/mpd/mpd.initd
@@ -0,0 +1,43 @@
+#!/sbin/runscript
+
+# init.d file for music player daemon
+
+NAME=mpd
+DAEMON=/usr/sbin/$NAME
+CONF=/etc/mpd.conf
+
+depend() {
+ need localmount
+ use net netmount nfsmount esound pulseaudio
+}
+
+checkconfig() {
+ [ -f "$CONF" ] && return 0
+ eerror "configuration file $CONF is missing"
+ return 1
+}
+
+get_pidfile() {
+ pidfile=$(awk '$1 == "pid_file" { print $2 }' "$CONF")
+ pidfile=${pidfile:-/var/run/mpd/$NAME.pid}
+}
+
+start() {
+ checkconf || return 1
+ get_pidfile
+ ebegin "Starting ${NAME}"
+ start-stop-daemon --start --quiet \
+ --pidfile $pidfile\
+ --exec ${DAEMON} -- ${MPD_OPTS}
+ eend $?
+}
+
+stop() {
+ get_pidfile
+ ebegin "Stopping ${NAME}"
+ start-stop-daemon --stop --quiet \
+ --pidfile $pidfile \
+ --exec ${DAEMON}
+ eend $?
+}
+