summaryrefslogtreecommitdiffstats
path: root/meta-networking/recipes-protocols/net-snmp/files/init
diff options
context:
space:
mode:
Diffstat (limited to 'meta-networking/recipes-protocols/net-snmp/files/init')
-rwxr-xr-xmeta-networking/recipes-protocols/net-snmp/files/init63
1 files changed, 63 insertions, 0 deletions
diff --git a/meta-networking/recipes-protocols/net-snmp/files/init b/meta-networking/recipes-protocols/net-snmp/files/init
new file mode 100755
index 000000000..434b2fa3f
--- /dev/null
+++ b/meta-networking/recipes-protocols/net-snmp/files/init
@@ -0,0 +1,63 @@
1#! /bin/sh
2# /etc/init.d/snmpd: start snmp daemon.
3
4test -x /usr/sbin/snmpd || exit 0
5test -x /usr/sbin/snmptrapd || exit 0
6
7# Defaults
8export MIBDIRS=/usr/share/snmp/mibs
9SNMPDRUN=yes
10SNMPDOPTS='-Lsd -Lf /dev/null -p /var/run/snmpd.pid'
11TRAPDRUN=no
12TRAPDOPTS='-Lsd -p /var/run/snmptrapd.pid'
13
14# Cd to / before starting any daemons.
15cd /
16
17case "$1" in
18 start)
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 \
22 -- $SNMPDOPTS
23 echo -n " snmpd"
24 fi
25 if [ "$TRAPDRUN" = "yes" -a -f /etc/snmp/snmptrapd.conf ]; then
26 start-stop-daemon -S -x /usr/sbin/snmptrapd \
27 -- $TRAPDOPTS
28 echo -n " snmptrapd"
29 fi
30 echo "."
31 ;;
32 stop)
33 echo -n "Stopping network management services:"
34 start-stop-daemon -K -x /usr/sbin/snmpd
35 echo -n " snmpd"
36 start-stop-daemon -K -x /usr/sbin/snmptrapd
37 echo -n " snmptrapd"
38 echo "."
39 ;;
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.
45 sleep 2
46 if [ "$SNMPDRUN" = "yes" -a -f /etc/snmp/snmpd.conf ]; then
47 start-stop-daemon -S -x /usr/sbin/snmpd -- $SNMPDOPTS
48 echo -n " snmpd"
49 fi
50 if [ "$TRAPDRUN" = "yes" -a -f /etc/snmp/snmptrapd.conf ]; then
51 # Allow snmpd time to start up.
52 sleep 1
53 start-stop-daemon -S -x /usr/sbin/snmptrapd -- $TRAPDOPTS
54 echo -n " snmptrapd"
55 fi
56 echo "."
57 ;;
58 *)
59 echo "Usage: /etc/init.d/snmpd {start|stop|restart|reload|force-reload}"
60 exit 1
61esac
62
63exit 0