summaryrefslogtreecommitdiff
path: root/recipes/net-snmp/files/init
diff options
context:
space:
mode:
authorDenys Dmytriyenko <denis@denix.org>2009-03-17 14:32:59 -0400
committerDenys Dmytriyenko <denis@denix.org>2009-03-17 14:32:59 -0400
commit709c4d66e0b107ca606941b988bad717c0b45d9b (patch)
tree37ee08b1eb308f3b2b6426d5793545c38396b838 /recipes/net-snmp/files/init
parentfa6cd5a3b993f16c27de4ff82b42684516d433ba (diff)
rename packages/ to recipes/ per earlier agreement
See links below for more details: http://thread.gmane.org/gmane.comp.handhelds.openembedded/21326 http://thread.gmane.org/gmane.comp.handhelds.openembedded/21816 Signed-off-by: Denys Dmytriyenko <denis@denix.org> Acked-by: Mike Westerhof <mwester@dls.net> Acked-by: Philip Balister <philip@balister.org> Acked-by: Khem Raj <raj.khem@gmail.com> Acked-by: Marcin Juszkiewicz <hrw@openembedded.org> Acked-by: Koen Kooi <koen@openembedded.org> Acked-by: Frans Meulenbroeks <fransmeulenbroeks@gmail.com>
Diffstat (limited to 'recipes/net-snmp/files/init')
-rwxr-xr-xrecipes/net-snmp/files/init63
1 files changed, 63 insertions, 0 deletions
diff --git a/recipes/net-snmp/files/init b/recipes/net-snmp/files/init
new file mode 100755
index 0000000000..434b2fa3f2
--- /dev/null
+++ b/recipes/net-snmp/files/init
@@ -0,0 +1,63 @@
+#! /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'
+
+# 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 -S -x /usr/sbin/snmpd \
+ -- $SNMPDOPTS
+ echo -n " snmpd"
+ fi
+ if [ "$TRAPDRUN" = "yes" -a -f /etc/snmp/snmptrapd.conf ]; then
+ start-stop-daemon -S -x /usr/sbin/snmptrapd \
+ -- $TRAPDOPTS
+ echo -n " snmptrapd"
+ fi
+ echo "."
+ ;;
+ stop)
+ echo -n "Stopping network management services:"
+ start-stop-daemon -K -x /usr/sbin/snmpd
+ echo -n " snmpd"
+ start-stop-daemon -K -x /usr/sbin/snmptrapd
+ echo -n " snmptrapd"
+ echo "."
+ ;;
+ restart|reload|force-reload)
+ echo -n "Restarting network management services:"
+ start-stop-daemon -K -x /usr/sbin/snmpd
+ start-stop-daemon -K -x /usr/sbin/snmptrapd
+ # Allow the daemons time to exit completely.
+ sleep 2
+ if [ "$SNMPDRUN" = "yes" -a -f /etc/snmp/snmpd.conf ]; then
+ start-stop-daemon -S -x /usr/sbin/snmpd -- $SNMPDOPTS
+ 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 -S -x /usr/sbin/snmptrapd -- $TRAPDOPTS
+ echo -n " snmptrapd"
+ fi
+ echo "."
+ ;;
+ *)
+ echo "Usage: /etc/init.d/snmpd {start|stop|restart|reload|force-reload}"
+ exit 1
+esac
+
+exit 0