summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2011-02-18 10:55:50 -0800
committerStephen Hemminger <stephen.hemminger@vyatta.com>2011-02-18 10:55:50 -0800
commitc8165a1a29572d7bf78d11c83afd18fff80a02f5 (patch)
tree65df52f63156acab6c830587ff3576856f9f1afb /scripts
parent636a269f9a3b4caeac9b5fa7bea360bfba814206 (diff)
downloadvyatta-cfg-quagga-c8165a1a29572d7bf78d11c83afd18fff80a02f5.tar.gz
vyatta-cfg-quagga-c8165a1a29572d7bf78d11c83afd18fff80a02f5.zip
Use standard mechanism to start/stop snmp
The net-snmp has snmpd.init script which is installed in standard place. Invoke it with standard mechanism to avoid any security or other problems. Also allows debugging snmpd by changing /etc/default/snmp.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/snmp/snmpd.init75
-rwxr-xr-xscripts/snmp/vyatta-snmp.pl2
2 files changed, 1 insertions, 76 deletions
diff --git a/scripts/snmp/snmpd.init b/scripts/snmp/snmpd.init
deleted file mode 100644
index 2261b721..00000000
--- a/scripts/snmp/snmpd.init
+++ /dev/null
@@ -1,75 +0,0 @@
-#! /bin/sh
-# /etc/init.d/snmpd: start snmp daemon.
-
-test -x /usr/sbin/snmpd || exit 0
-test -x /usr/sbin/snmptrapd || exit 0
-
-# Defaults
-export MIBDIRS=/usr/share/snmp/mibs
-SNMPDRUN=yes
-SNMPDOPTS='-Lsd -Lf /dev/null -p /var/run/snmpd.pid'
-TRAPDRUN=no
-TRAPDOPTS='-Lsd -p /var/run/snmptrapd.pid'
-
-# Reads config file (will override defaults above)
-[ -r /etc/default/snmpd ] && . /etc/default/snmpd
-
-# Cd to / before starting any daemons.
-cd /
-
-case "$1" in
- start)
- echo -n "Starting network management services:"
- if [ "$SNMPDRUN" = "yes" -a -f /etc/snmp/snmpd.conf ]; then
- start-stop-daemon --quiet --start --exec /usr/sbin/snmpd \
- -- -p /var/run/snmpd.pid -u snmp
- echo -n " snmpd"
- fi
- if [ "$TRAPDRUN" = "yes" -a -f /etc/snmp/snmptrapd.conf ]; then
- start-stop-daemon --quiet --start --exec /usr/sbin/snmptrapd \
- -- $TRAPDOPTS
- echo -n " snmptrapd"
- fi
- echo "."
- ;;
- stop)
- echo -n "Stopping network management services:"
- start-stop-daemon --quiet --stop --pidfile /var/run/snmpd.pid
- echo -n " snmpd"
- start-stop-daemon --quiet --stop --pidfile /var/run/snmptrapd.pid
- echo -n " snmptrapd"
- echo "."
- ;;
- restart)
- echo -n "Restarting network management services:"
- start-stop-daemon --quiet --stop --pidfile /var/run/snmpd.pid
- start-stop-daemon --quiet --stop --pidfile /var/run/snmptrapd.pid
- # Allow the daemons time to exit completely.
- sleep 2
- if [ "$SNMPDRUN" = "yes" -a -f /etc/snmp/snmpd.conf ]; then
- start-stop-daemon --quiet --start --exec /usr/sbin/snmpd -- -p /var/run/snmpd.pid -u snmp
- echo -n " snmpd"
- fi
- if [ "$TRAPDRUN" = "yes" -a -f /etc/snmp/snmptrapd.conf ]; then
- # Allow snmpd time to start up.
- sleep 1
- start-stop-daemon --quiet --start --exec /usr/sbin/snmptrapd -- $TRAPDOPTS
- echo -n " snmptrapd"
- fi
- echo "."
- ;;
- reload|force-reload)
- echo -n "Reloading network management services:"
- if [ "$SNMPDRUN" = "yes" -a -f /etc/snmp/snmpd.conf ]; then
- start-stop-daemon --quiet --stop --signal 1 \
- --pidfile /var/run/snmpd.pid --exec /usr/sbin/snmpd
- echo -n " snmpd"
- fi
- echo "."
- ;;
- *)
- echo "Usage: /etc/init.d/snmpd {start|stop|restart|reload|force-reload}"
- exit 1
-esac
-
-exit 0
diff --git a/scripts/snmp/vyatta-snmp.pl b/scripts/snmp/vyatta-snmp.pl
index a812eb32..01283870 100755
--- a/scripts/snmp/vyatta-snmp.pl
+++ b/scripts/snmp/vyatta-snmp.pl
@@ -34,7 +34,7 @@ use strict;
use warnings;
my $mibdir = '/opt/vyatta/share/snmp/mibs';
-my $snmp_init = '/opt/vyatta/sbin/snmpd.init';
+my $snmp_init = 'invoke-rc.d snmpd';
my $snmp_conf = '/etc/snmp/snmpd.conf';
my $snmp_client = '/etc/snmp/snmp.conf';
my $snmp_tmp = "/tmp/snmpd.conf.$$";