blob: 8c72326f3e606b48f3ae7dcf1d1913a0c8e29dbc (
plain) (
blame)
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: snmpd
# REQUIRE: DAEMON
#
# Add the following line to /etc/rc.conf to enable snmpd:
#
# snmpd_enable="YES"
# snmpd_flags="<set as needed>"
#
snmpd_enable=${snmpd_enable-"NO"}
snmpd_pidfile=${snmpd_pidfile-"/var/run/snmpd.pid"}
snmpd_conffile=${snmpd_conffile-""}
snmpd_flush_cache=${snmpd_flush_cache-"NO"}
. %%RC_SUBR%%
load_rc_config net_snmpd
if [ ! -z "$net_snmpd_enable" ]; then
echo "Warning: \$net_snmpd_enable is obsoleted."
echo " Use \$snmpd_enable instead."
snmpd_enable="$net_snmpd_enable"
[ ! -z "$net_snmpd_flags" ] && snmpd_flags="$net_snmpd_flags"
fi
name=snmpd
rcvar=`set_rcvar`
command=%%PREFIX%%/sbin/${name}
pidfile=${snmpd_pidfile}
start_precmd=snmpd_precmd
load_rc_config ${name}
snmpd_precmd () {
if checkyesno snmpd_flush_cache; then
rm -vf /var/net-snmp/.snmp-exec-cache
fi
}
case "${snmpd_flags}" in
*-p\ *)
echo "Warning: \$snmpd_flags includes -p option." \
"Please use \$snmpd_pidfile instead."
;;
*)
snmpd_flags="-p ${snmpd_pidfile} ${snmpd_flags}"
;;
esac
for conffile in ${snmpd_conffile}; do
if [ ! -z ${conffile} -a -f ${conffile} ]; then
if [ -z ${snmpd_conffile_set} ]; then
snmpd_conffile_set="${conffile}"
else
snmpd_conffile_set="${snmpd_conffile_set},${conffile}"
fi
else
echo "snmpd configuration file $conffile not set or not found."
exit 1
fi
done
case "${snmpd_flags}" in
*-c\ *)
echo "Warning: \$snmpd_flags includes -c option." \
"Please use \$snmpd_conffile instead."
;;
*)
if [ ! -z "${snmpd_conffile_set}" ]; then
snmpd_flags="-c ${snmpd_conffile_set} ${snmpd_flags}"
fi
;;
esac
run_rc_command "$1"
|