#!/sbin/runscript # Copyright 1999-2009 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ opts="${opts} reload" depend() { use logger need net } SNMPD_PIDFILE="${SNMPD_PIDFILE:-/var/run/snmpd.pid}" checkconfig() { if [ ! -e /etc/snmp/snmpd.conf ] ; then eerror "${SVCNAME} requires an /etc/snmp/snmpd.conf configuration file" return 1 fi } start() { checkconfig || return 1 ebegin "Starting ${SVCNAME}" start-stop-daemon --start --quiet --exec /usr/sbin/snmpd \ -- -p ${SNMPD_PIDFILE} ${SNMPD_FLAGS} eend $? } stop() { ebegin "Stopping ${SVCNAME}" start-stop-daemon --stop --quiet --pidfile ${SNMPD_PIDFILE} eend $? } reload() { checkconfig || return 1 if [ ! -f ${SNMPD_PIDFILE} ]; then eerror "Cannot reload configuration, ${SVCNAME} is not running" eend 1 return 1 fi ebegin "Reloading ${SVCNAME} configuration" kill -HUP $(< ${SNMPD_PIDFILE}) &>/dev/null eend $? }