2 # /etc/init.d/snmpd: start snmp daemon.
4 test -x /usr/sbin/snmpd || exit 0
5 test -x /usr/sbin/snmptrapd || exit 0
8 export MIBDIRS=/usr/share/snmp/mibs
10 SNMPDOPTS='-Lsd -Lf /dev/null -p /var/run/snmpd.pid'
12 TRAPDOPTS='-Lsd -p /var/run/snmptrapd.pid'
14 # Cd to / before starting any daemons.
19 echo -n "Starting network management services:"
20 if [ "$SNMPDRUN" = "yes" -a -f /etc/snmp/snmpd.conf ]; then
21 start-stop-daemon -S -x /usr/sbin/snmpd \
25 if [ "$TRAPDRUN" = "yes" -a -f /etc/snmp/snmptrapd.conf ]; then
26 start-stop-daemon -S -x /usr/sbin/snmptrapd \
33 echo -n "Stopping network management services:"
34 start-stop-daemon -K -x /usr/sbin/snmpd
36 start-stop-daemon -K -x /usr/sbin/snmptrapd
40 restart|reload|force-reload)
41 echo -n "Restarting network management services:"
42 start-stop-daemon -K -x /usr/sbin/snmpd
43 start-stop-daemon -K -x /usr/sbin/snmptrapd
44 # Allow the daemons time to exit completely.
46 if [ "$SNMPDRUN" = "yes" -a -f /etc/snmp/snmpd.conf ]; then
47 start-stop-daemon -S -x /usr/sbin/snmpd -- $SNMPDOPTS
50 if [ "$TRAPDRUN" = "yes" -a -f /etc/snmp/snmptrapd.conf ]; then
51 # Allow snmpd time to start up.
53 start-stop-daemon -S -x /usr/sbin/snmptrapd -- $TRAPDOPTS
59 echo "Usage: /etc/init.d/snmpd {start|stop|restart|reload|force-reload}"