updated on Mon Jan 16 12:07:49 UTC 2012
[aur-mirror.git] / mpd-fork-git / mpd.init
blob76ec1c0960581ef98e65a15d6c759129c41d422b
1 #!/bin/bash
3 . /etc/rc.conf
4 . /etc/rc.d/functions
6 case "$1" in
7 start)
8 stat_busy "Starting Music Player Daemon"
9 /usr/bin/mpd /etc/mpd.conf &> /dev/null
10 if [ $? -gt 0 ]; then
11 stat_fail
12 else
13 add_daemon mpd
14 stat_done
17 stop)
18 stat_busy "Stopping Music Player Daemon"
19 /usr/bin/mpd --kill /etc/mpd.conf &> /dev/null
20 if [ $? -gt 0 ]; then
21 stat_fail
22 else
23 rm_daemon mpd
24 stat_done
27 create-db)
28 stat_busy "Creating mpd's database ..."
29 logpath="/var/log/mpd/mpd.db-creation"
30 /usr/bin/mpd --create-db /etc/mpd.conf > $logpath \
31 && stat_busy "Output written to $logpath"
32 stat_done
34 restart)
35 $0 stop
36 sleep 1
37 $0 start
40 echo "usage: $0 {start|stop|restart|create-db}"
41 esac
42 exit 0