Package: snmpd
Version: 5.4.1~dfsg-12
Severity: wishlist
Tags: patch
User: pet...@debian.org
Usertags: initd-status-support

Here is a patch to support the "status" action in the init.d script.
diff -u net-snmp-5.4.1~dfsg/debian/snmpd.init net-snmp-5.4.1~dfsg/debian/snmpd.init
--- net-snmp-5.4.1~dfsg/debian/snmpd.init
+++ net-snmp-5.4.1~dfsg/debian/snmpd.init
@@ -13,6 +13,8 @@
 #
 set -e
 
+. /lib/lsb/init-functions
+
 export PATH=/sbin:/usr/sbin:/bin:/usr/bin
 
 test -x /usr/sbin/snmpd || exit 0
@@ -32,7 +34,7 @@
 cd /
 
 # Create compatibility link to old AgentX socket location
-if [ "$SNMPDCOMPAT" = "yes" ]; then
+if [ "$SNMPDCOMPAT" = "yes" ] && [ "$1" != status ]; then
   ln -sf /var/agentx/master /var/run/agentx
 fi
 
@@ -86,8 +88,14 @@
     fi
     echo "."
     ;;
+  status)
+    status=0
+    status_of_proc /usr/sbin/snmpd snmpd || status=$?
+    status_of_proc /usr/sbin/snmptrapd snmptrapd || status=$?
+    exit $status
+    ;;
   *)
-    echo "Usage: /etc/init.d/snmpd {start|stop|restart|reload|force-reload}"
+    echo "Usage: /etc/init.d/snmpd {start|stop|restart|reload|force-reload|status}"
     exit 1
 esac
 
diff -u net-snmp-5.4.1~dfsg/debian/control net-snmp-5.4.1~dfsg/debian/control
--- net-snmp-5.4.1~dfsg/debian/control
+++ net-snmp-5.4.1~dfsg/debian/control
@@ -16,7 +16,7 @@
 Architecture: any
 Conflicts: snmp (<<3.6-3), snmptraplogd
 Replaces: snmptraplogd
-Depends: ${shlibs:Depends}, adduser, debconf
+Depends: ${shlibs:Depends}, adduser, debconf, lsb-base (>= 3.2-13)
 Description: SNMP (Simple Network Management Protocol) agents
  The Simple Network Management Protocol (SNMP) provides a framework
  for the exchange of management information between agents (servers)

Reply via email to