blob: 4e34564294d449c4cc93f739377d6144ab30df4d (
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
58
59
60
61
62
63
64
|
#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: pmacctd
# REQUIRE: DAEMON
# BEFORE: LOGIN
# KEYWORD: shutdown
# You can define flags for pmacctd running.
# See http://wiki.pmacct.net/OfficialConfigKeys for more details.
#
# pmacctd_enable (bool): Set to YES to enable pmacctd
# Default: NO
# pmacctd_flags (str): Extra flags passed to pmacctd
# Default: -D
# pmacctd_conf (str): pmacctd configuration file
# Default: %%PREFIX%%/etc/pmacctd.conf
#
# To enable multi interface, use:
# pmacctd_interfaces="em0 em1"
#
# defaults will follow, pmacctd_conf becomes 'pmacctd_em0_conf', etc.
. /etc/rc.subr
name="pmacctd"
rcvar=pmacctd_enable
command="%%PREFIX%%/sbin/$name"
load_rc_config $name
[ -z "$pmacctd_enable" ] && pmacctd_enable="NO"
[ -z "$pmacctd_conf" ] && pmacctd_conf="%%PREFIX%%/etc/pmacctd.conf"
[ -z "$pmacctd_flags" ] && pmacctd_flags="-D"
[ -n "$pmacctd_conf" ] && pmacctd_flags="$pmacctd_flags -f $pmacctd_conf"
if [ -n "$pmacctd_interfaces" ]; then
_1=$1
if [ $# -gt 1 ]; then shift; pmacctd_interfaces=$*; fi
pmacctd_conf=""
pmacctd_flags=""
rc=0
for i in ${pmacctd_interfaces}; do
eval _conf=\$pmacctd_${i}_conf
eval _flags=\$pmacctd_${i}_flags
[ -z "$_conf" ] && _conf="%%PREFIX%%/etc/pmacct/$i"
[ -z "$_flags" ] && _flags="-D"
eval pidfile="/var/run/pmacct/${i}.pid"
command_args="$_flags -F $pidfile -f $_conf -i $i"
run_rc_command "$_1"
if [ $? -ne 0 ]; then rc=1; fi
unset _pidcmd _rc_restart_done
done
exit $rc
else
run_rc_command "$1"
fi
|