]> git.pld-linux.org Git - packages/mpd.git/blame - mpd.init
- unify
[packages/mpd.git] / mpd.init
CommitLineData
f337750d
ZU
1#!/bin/sh
2#
3# chkconfig: 2345 85 15
4#
5# description: Music Player Daemon
6#
7# processname: mpd
8# pidfile: /var/run/mpd/mpd.pid
9# config: /etc/mpd.conf
10
11# Source function library
12. /etc/rc.d/init.d/functions
13
14start() {
15 # Check if the service is already running?
256f16ab
ER
16 if [ -f /var/lock/subsys/mpd ]; then
17 msg_already_running "Music Player Daemon"
18 return
f337750d 19 fi
256f16ab
ER
20
21 msg_starting "Music Player Daemon"
22 OPTIONS=""
23 daemon /usr/bin/mpd
24 RETVAL=$?
25 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/mpd
f337750d
ZU
26}
27
28stop() {
256f16ab
ER
29 if [ ! -f /var/lock/subsys/mpd ]; then
30 msg_not_running "Music Player Daemon"
31 return
f337750d 32 fi
256f16ab
ER
33
34 msg_stopping "Music Player Daemon"
35 killproc mpd
36 rm -f /var/lock/subsys/mpd >/dev/null 2>&1
f337750d
ZU
37}
38
0541a49f
JB
39condrestart() {
40 if [ -f /var/lock/subsys/mpd ]; then
0541a49f
JB
41 msg_not_running mpd
42 RETVAL=$1
256f16ab 43 return
0541a49f 44 fi
256f16ab
ER
45
46 stop
47 start
0541a49f
JB
48}
49
f337750d
ZU
50RETVAL=0
51# See how we were called.
52case "$1" in
53 start)
54 start
55 ;;
56 stop)
57 stop
58 ;;
0541a49f 59 restart)
f337750d
ZU
60 stop
61 start
62 ;;
0541a49f
JB
63 try-restart)
64 condrestart 0
65 ;;
66 force-reload)
67 condrestart 7
68 ;;
f337750d
ZU
69 status)
70 status mpd
71 exit $?
72 ;;
73 *)
0541a49f 74 msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}"
f337750d
ZU
75 exit 3
76esac
77
78exit $RETVAL
This page took 0.575057 seconds and 4 git commands to generate.