[Pkg-net-snmp-devel] Bug#615846: snmpd: init script using wrong return code on option "status"

Alexander Pyhalov alp at rsu.ru
Thu May 10 06:38:45 UTC 2012


Hello.

The bug is still actual: init script returns 3 when TRAPDRUN=no is set 
in /etc/default/snmpd, snmpd is runnning and snmptrapd is not. In 
particular, this situation annoys puppet: it complains that snmpd is not 
running and restarts this service.

I'm running squeeze 6.0.4 and have snmpd package version 5.4.3~dfsg-2 
installed.


The fix is the following:

--- /etc/init.d/snmpd	2011-01-05 15:12:04.000000000 +0300
+++ /etc/init.d/snmpd.patchec	2012-05-10 10:23:21.638637224 +0400
@@ -90,8 +90,12 @@
      ;;
    status)
      status=0
-    status_of_proc /usr/sbin/snmpd snmpd || status=$?
-    status_of_proc /usr/sbin/snmptrapd snmptrapd || status=$?
+    if [ "$SNMPDRUN" = "yes" ]; then
+        status_of_proc /usr/sbin/snmpd snmpd || status=$?
+    fi
+    if [ "$TRAPDRUN" = "yes" ]; then
+        status_of_proc /usr/sbin/snmptrapd snmptrapd || status=$?
+    fi
      exit $status
      ;;
    *)

-- 
Best regards,
Alexander Pyhalov,
system administrator of Computer Center of Southern Federal University





More information about the Pkg-net-snmp-devel mailing list