diff options
Diffstat (limited to 'net-mgmt/net-snmp/files/snmpd.sh.sample')
-rw-r--r-- | net-mgmt/net-snmp/files/snmpd.sh.sample | 55 |
1 files changed, 27 insertions, 28 deletions
diff --git a/net-mgmt/net-snmp/files/snmpd.sh.sample b/net-mgmt/net-snmp/files/snmpd.sh.sample index a626c9b9e26e..f07a6fac2376 100644 --- a/net-mgmt/net-snmp/files/snmpd.sh.sample +++ b/net-mgmt/net-snmp/files/snmpd.sh.sample @@ -1,36 +1,35 @@ #!/bin/sh # # $FreeBSD$ +# +# PROVIDE: snmpd +# REQUIRE: DAEMON +# KEYWORD: FreeBSD +# +# Add the following line to /etc/rc.conf to enable snmpd: +# +# snmpd_enable="YES" +# -if ! PREFIX=$(expr $0 : "\(/.*\)/etc/rc\.d/$(basename $0)\$"); then - echo "$0: Cannot determine the PREFIX" >&2 - exit 1 -fi +snmpd_enable="NO" +snmpd_flags="-P /var/run/snmpd.pid" + +. %%RC_SUBR%% -if [ -z "${source_rc_confs_defined}" ]; then - if [ -r /etc/defaults/rc.conf ]; then - . /etc/defaults/rc.conf - source_rc_confs - elif [ -r /etc/rc.conf ]; then - . /etc/rc.conf - fi +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 -case "$1" in -start) - case "${net_snmpd_enable}" in - [Yy][Ee][Ss]) - echo -n ' snmpd' - ${net_snmpd_program:-${PREFIX}/sbin/snmpd} ${net_snmpd_flags} - ;; - esac - ;; -stop) - killall snmpd && echo -n ' snmpd' - ;; -*) - echo "Usage: `basename $0` {start|stop}" >&2 - ;; -esac +name=snmpd +rcvar=`set_rcvar` + +command=%%PREFIX%%/sbin/snmpd +pidfile='/var/run/snmpd.pid' -exit 0 +load_rc_config $name +run_rc_command "$1" |