summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoruniverse II <universeii@gmx.de>2016-02-25 22:24:44 +0100
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>2016-07-01 14:53:11 +0200
commit45136f30973f2767a9db6293f081024140f086d0 (patch)
tree270500380a4d95d23356c3f080e9c0edd6c08e29
parent6eba255b716865fcb688afe627eb1568718bc09b (diff)
downloadbuildroot-45136f30973f2767a9db6293f081024140f086d0.tar.gz
buildroot-45136f30973f2767a9db6293f081024140f086d0.zip
netsnmp: add OK/FAIL output in init script
This commit reworks the output of the start(), stop() and reload() functions. The return values of start-stop-daemon are now checked and a OK or FAIL message is printed out. Signed-off-by: Andreas Ehmanns <universeII@gmx.de> Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
-rwxr-xr-xpackage/netsnmp/S59snmpd35
1 files changed, 21 insertions, 14 deletions
diff --git a/package/netsnmp/S59snmpd b/package/netsnmp/S59snmpd
index 2d076e0eab..4ff844ee3a 100755
--- a/package/netsnmp/S59snmpd
+++ b/package/netsnmp/S59snmpd
@@ -38,39 +38,45 @@ if [ "$SNMPDCOMPAT" = "yes" ]; then
fi
start() {
- printf "Starting network management services:"
if [ "$SNMPDRUN" = "yes" -a -f /etc/snmp/snmpd.conf ]; then
+ printf "Starting SNMP daemon: "
start-stop-daemon -q -S -x /usr/sbin/snmpd -- $SNMPDOPTS
- printf " snmpd"
+ [ $? = 0 ] && echo "OK" || echo "FAIL"
fi
+
if [ "$TRAPDRUN" = "yes" -a -f /etc/snmp/snmptrapd.conf ]; then
+ printf "Starting SNMP trap daemon: "
start-stop-daemon -q -S -x /usr/sbin/snmptrapd -- $TRAPDOPTS
- printf " snmptrapd"
+ [ $? = 0 ] && echo "OK" || echo "FAIL"
fi
- echo "."
}
stop() {
- printf "Stopping network management services:"
- start-stop-daemon -q -K $ssd_oknodo -x /usr/sbin/snmpd
- printf " snmpd"
- start-stop-daemon -q -K $ssd_oknodo -x /usr/sbin/snmptrapd
- printf " snmptrapd"
- echo "."
+ if [ "$SNMPDRUN" = "yes" -a -f /etc/snmp/snmpd.conf ]; then
+ printf "Stopping SNMP daemon: "
+ start-stop-daemon -q -K $ssd_oknodo -x /usr/sbin/snmpd
+ [ $? = 0 ] && echo "OK" || echo "FAIL"
+ fi
+
+ if [ "$TRAPDRUN" = "yes" -a -f /etc/snmp/snmptrapd.conf ]; then
+ printf "Stopping SNMP trap daemon: "
+ start-stop-daemon -q -K $ssd_oknodo -x /usr/sbin/snmptrapd
+ [ $? = 0 ] && echo "OK" || echo "FAIL"
+ fi
}
reload() {
- printf "Reloading network management services:"
if [ "$SNMPDRUN" = "yes" -a -f /etc/snmp/snmpd.conf ]; then
+ printf "Reloading SNMP daemon: "
start-stop-daemon -q -K -s 1 -p /var/run/snmpd.pid -x /usr/sbin/snmpd
- printf " snmpd"
+ [ $? = 0 ] && echo "OK" || echo "FAIL"
fi
if [ "$TRAPDRUN" = "yes" -a -f /etc/snmp/snmptrapd.conf ]; then
+ printf "Reloading SNMP trap daemon: "
start-stop-daemon -q -K -s 1 -p /var/run/snmptrapd.pid -x /usr/sbin/snmptrapd
- printf " snmptrapd"
+ [ $? = 0 ] && echo "OK" || echo "FAIL"
fi
- echo "."
}
case "$1" in
@@ -92,6 +98,7 @@ case "$1" in
reload|force-reload)
reload
;;
+
*)
echo "Usage: $0 {start|stop|restart|reload|force-reload}"
exit 1
OpenPOWER on IntegriCloud