Lines 1-37
Link Here
|
1 |
#!/bin/sh |
1 |
#!/bin/sh |
|
|
2 |
# |
2 |
# $FreeBSD: ports/net/mpd/files/mpd.sh,v 1.1 2003/11/22 20:51:05 archie Exp $ |
3 |
# $FreeBSD: ports/net/mpd/files/mpd.sh,v 1.1 2003/11/22 20:51:05 archie Exp $ |
|
|
4 |
# |
5 |
# PROVIDE: mpd |
6 |
# REQUIRE: NETWORKING |
7 |
# KEYWORD: FreeBSD |
8 |
# |
9 |
# Add the following line to /etc/rc.conf to enable mpd: |
10 |
# |
11 |
# mpd_enable="YES" |
12 |
# |
3 |
|
13 |
|
4 |
DAEMON=/usr/local/sbin/mpd |
14 |
mpd_flags="-b" |
5 |
PIDFILE=/var/run/mpd.pid |
15 |
mpd_enable="NO" |
6 |
|
16 |
|
7 |
case "$1" in |
17 |
. %%RC_SUBR%% |
8 |
start) |
|
|
9 |
if [ -f "${DAEMON}" -a -x "${DAEMON}" ]; then |
10 |
if [ -f "${PIDFILE}" ]; then |
11 |
echo ' mpd PID file found - not starting' |
12 |
else |
13 |
"${DAEMON}" -b -p "${PIDFILE}" |
14 |
echo -n ' mpd' |
15 |
fi |
16 |
else |
17 |
echo ' "${DAEMON}" executable not found - mpd not starting' |
18 |
fi |
19 |
;; |
20 |
stop) |
21 |
if [ -f "${PIDFILE}" ]; then |
22 |
read -r pid junk < "${PIDFILE}" |
23 |
kill ${pid} |
24 |
else |
25 |
echo ' mpd PID file not found - not killing' |
26 |
fi |
27 |
;; |
28 |
restart) |
29 |
$0 stop |
30 |
sleep 2 |
31 |
$0 start |
32 |
;; |
33 |
*) |
34 |
echo "usage: ${0##*/} {start|stop|restart}" >&2 |
35 |
;; |
36 |
esac |
37 |
|
18 |
|
|
|
19 |
name=mpd |
20 |
rcvar=`set_rcvar` |
21 |
|
22 |
prefix=%%PREFIX%% |
23 |
procname=${prefix}/sbin/mpd |
24 |
pidfile=/var/run/mpd.pid |
25 |
required_files="${prefix}/etc/mpd/mpd.conf ${prefix}/etc/mpd/mpd.links" |
26 |
command="${prefix}/sbin/mpd" |
27 |
|
28 |
load_rc_config ${name} |
29 |
run_rc_command "$1" |