Lines 1-29
Link Here
|
1 |
#!/bin/sh |
1 |
#!/bin/sh |
|
|
2 |
# $FreeBSD: $ |
2 |
|
3 |
|
3 |
if ! PREFIX=$(expr $0 : "\(/.*\)/etc/rc\.d/$(basename $0)\$"); then |
4 |
# PROVIDE: smokeping |
4 |
echo "$0: Cannot determine the PREFIX" >&2 |
5 |
# REQUIRE: DAEMON |
5 |
exit 1 |
6 |
# BEFORE: LOGIN |
6 |
fi |
7 |
# KEYWORD: shutdown |
7 |
|
|
|
8 |
case "$1" in |
9 |
start) |
10 |
[ -r ${PREFIX}/etc/smokeping/config ] && \ |
11 |
su -f -m smokeping -c ${PREFIX}/bin/smokeping > /dev/null && \ |
12 |
echo -n ' smokeping' |
13 |
;; |
14 |
restart) |
15 |
[ -r ${PREFIX}/etc/smokeping/config ] && \ |
16 |
su -f -m smokeping -c "${PREFIX}/bin/smokeping --restart" > /dev/null && \ |
17 |
echo -n ' smokeping' |
18 |
;; |
19 |
stop) |
20 |
[ -r ${PREFIX}/var/smokeping/smokeping.pid ] && \ |
21 |
su -f -m smokeping -c "kill `cat ${PREFIX}/var/smokeping/smokeping.pid`" > /dev/null && \ |
22 |
echo -n ' smokeping' |
23 |
;; |
24 |
*) |
25 |
echo "Usage: `basename $0` {start|restart|stop}" >&2 |
26 |
;; |
27 |
esac |
28 |
|
8 |
|
29 |
exit 0 |
9 |
# Define these smokeping_* variables in one of these files: |
|
|
10 |
# /etc/rc.conf |
11 |
# /etc/rc.conf.local |
12 |
# /etc/rc.conf.d/smokeping |
13 |
# |
14 |
# DO NOT CHANGE THESE DEFAULT VALUES HERE |
15 |
# |
16 |
smokeping_enable=${smokeping_enable-"NO"} |
17 |
smokeping_flags=${smokeping_flags-""} |
18 |
smokeping_pidfile=${smokeping_pidfile-"/usr/local/var/smokeping/smokeping.pid"} |
19 |
|
20 |
. /etc/rc.subr |
21 |
|
22 |
name="smokeping" |
23 |
rcvar=`set_rcvar` |
24 |
command="/usr/local/bin/smokeping" |
25 |
|
26 |
load_rc_config $name |
27 |
|
28 |
pidfile="${smokeping_pidfile}" |
29 |
|
30 |
run_rc_command "$1" |