[Buildroot] [PATCH v2 1/3] netsnmp: fix stop and restart actions in init script

Luca Ceresoli luca at lucaceresoli.net
Thu Jun 16 15:27:11 UTC 2011

/etc/init.d/S59snmpd stop (and restart) currently fail if either snmpd or
snmptrapd are not running.
This is because start-stop-daemon -K returns nonzero if the process to be
killed is not running, and this causes the whole script to fail because it runs
under 'set -e'.

This may not be noticed if only the last start-stop-daemon fails, but this is
in general wrong. It would also cause a failure in other scripts that execute
S59snmpd and check the return value.

Adding the --oknodo (-o) option to start-stop-daemon fixes this.

Signed-off-by: Luca Ceresoli <luca at lucaceresoli.net>
Changes in v2: none.

 package/netsnmp/S59snmpd |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/package/netsnmp/S59snmpd b/package/netsnmp/S59snmpd
index f65317a..5df4b85 100755
--- a/package/netsnmp/S59snmpd
+++ b/package/netsnmp/S59snmpd
@@ -29,7 +29,6 @@ TRAPDOPTS='-Lsd -p /var/run/snmptrapd.pid'
 [ -r /etc/default/snmpd ] && . /etc/default/snmpd
 # Cd to / before starting any daemons.
 cd /

More information about the buildroot mailing list