blob: cbaae6925e14019f7f73871df32d87fe2b286a11 (
plain)
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
|
#!/bin/sh
# PROVIDE: ipv6mon
# REQUIRE: DAEMON
# BEFORE: LOGIN
# KEYWORD: nojail shutdown
# $ipv6mon_interfaces:
# If specified, multiple instances of ipv6mon are invoked.
# Configuration files for each interfaces are automatically
# generated from %%PREFIX%%/etc/ipv6mon.conf.
#
# Example:
# ipv6mon_interfaces="bge0 bge1"
#
# An interface can be specified in a command line argument. If
# not specified, the action is applied to all of the interfaces.
#
# # service ipv6mon start bge0
#
. /etc/rc.subr
name="ipv6mon"
rcvar="${name}_enable"
command="%%PREFIX%%/sbin/${name}"
required_files="%%PREFIX%%/etc/${name}.conf"
start_precmd="start_precmd"
: ${ipv6mon_enable:=NO}
start_precmd()
{
for ifn in $ipv6mon_interfaces; do
(grep -v "LockFile=\|AddressLogFile=\|NetworkInterface=" \
%%PREFIX%%/etc/${name}.conf
echo "NetworkInterface=${ifn}"
echo "LockFile=/var/run/${name}-${ifn}.pid"
echo "AddressLogFile=/var/log/${name}-${ifn}.log"
) > "/var/run/${name}-${ifn}.conf"
done
}
load_rc_config $name
case ${2:-$ipv6mon_interfaces} in
"")
pidfile="/var/run/${name}.pid"
run_rc_command "$1"
;;
*)
for ifn in ${2:-$ipv6mon_interfaces}; do
pidfile="/var/run/${name}${ifn:+-}${ifn}.pid"
command_args="$command_args \
-c /var/run/${name}${ifn:+-}${ifn}.conf"
run_rc_command "$1"
done
;;
esac
|