-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmpd.init
82 lines (71 loc) · 1.2 KB
/
mpd.init
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#!/bin/sh
#
# chkconfig: 2345 85 15
#
# description: Music Player Daemon
#
# processname: mpd
# pidfile: /var/run/mpd/mpd.pid
# config: /etc/mpd.conf
# Source function library
. /etc/rc.d/init.d/functions
MPD_OPTIONS=""
# Get service config - may override defaults
[ -f /etc/sysconfig/mpd ] && . /etc/sysconfig/mpd
start() {
# Check if the service is already running?
if [ -f /var/lock/subsys/mpd ]; then
msg_already_running "Music Player Daemon"
return
fi
msg_starting "Music Player Daemon"
daemon /usr/bin/mpd
RETVAL=$?
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/mpd
}
stop() {
if [ ! -f /var/lock/subsys/mpd ]; then
msg_not_running "Music Player Daemon"
return
fi
msg_stopping "Music Player Daemon"
killproc mpd
rm -f /var/lock/subsys/mpd >/dev/null 2>&1
}
condrestart() {
if [ -f /var/lock/subsys/mpd ]; then
msg_not_running mpd
RETVAL=$1
return
fi
stop
start
}
RETVAL=0
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
try-restart)
condrestart 0
;;
force-reload)
condrestart 7
;;
status)
status mpd
exit $?
;;
*)
msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}"
exit 3
esac
exit $RETVAL