forked from dancrossnyc/44ripd
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathampr_44ripd.sh
executable file
·61 lines (51 loc) · 1 KB
/
ampr_44ripd.sh
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
#!/bin/sh
#
# PROVIDE: ampr_44ripd
# REQUIRE: routing
# KEYWORD: shutdown
#
. /etc/rc.subr
name=ampr_44ripd
rcvar=`set_rcvar`
load_rc_config ${name}
: ${ampr_44ripd_enable:="NO"}
ampr_44ripd_prog=${ampr_44ripd_prog:="/usr/local/libexec/44ripd"}
PIDFILE=${ampr_44ripd_pidfile:="/var/run/44ripd.pid"}
case "${ampr_44ripd_enable}" in
YES|Yes|yes)
ampr_44ripd_enable=1
;;
NO|No|no|*)
ampr_44ripd_enable=0
;;
esac
case "$1" in
"start")
if [ ${ampr_44ripd_enable} == 0 ]; then
exit 0
fi
echo -n "Starting 44ripd..."
${ampr_44ripd_prog} ${ampr_44ripd_options} ${ampr_44ripd_local_ip} ${ampr_44ripd_ampr_ip}
echo $! > ${PIDFILE}
echo "done"
;;
"stop")
echo -n "Stopping 44ripd..."
if [ -f ${PIDFILE} ] ; then
kill `cat ${PIDFILE}`
rm ${PIDFILE}
echo "done"
else
echo "not running?"
fi
;;
"restart")
echo -n "Restarting 44ripd..."
$0 stop
sleep 2
$0 start
;;
*)
echo "$0 [start|stop|restart]"
;;
esac