[Pkg-net-snmp-commits] [pkg-net-snmp] 09/16: fix #746397

Hideki Yamane henrich at moszumanska.debian.org
Sun Aug 28 02:19:44 UTC 2016


This is an automated email from the git hooks/post-receive script.

henrich pushed a commit to branch master
in repository pkg-net-snmp.

commit e7bf6ec23e2c104c8880b751ee7592c47102c063
Author: Hideki Yamane <henrich at debian.org>
Date:   Thu Feb 4 22:26:37 2016 +0900

    fix #746397
---
 debian/changelog  |  2 ++
 debian/snmpd.init | 38 ++++++++++++++++++++++----------------
 2 files changed, 24 insertions(+), 16 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index e04a9f3..1756eee 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -26,6 +26,8 @@ net-snmp (5.7.3+dfsg-2) UNRELEASED; urgency=medium
   * debian/rules
     - make it parallel build
   * move debian/NEWS to debian/snmpd.NEWS (Closes: #586722, #587183)
+  * make init script sane (add Missing log_end_msg, etc) (Closes: #746397)
+    Thanks to Uwe Storbeck <uwe at ibr.ch> for the patch.
 
  -- Hideki Yamane <henrich at debian.org>  Thu, 18 Jun 2015 06:43:28 +0900
 
diff --git a/debian/snmpd.init b/debian/snmpd.init
index 3e6dc03..fac8a32 100644
--- a/debian/snmpd.init
+++ b/debian/snmpd.init
@@ -1,4 +1,4 @@
-#! /bin/sh
+#!/bin/sh
 ### BEGIN INIT INFO
 # Provides:           snmpd
 # Required-Start:     $network $remote_fs $syslog
@@ -34,9 +34,11 @@ SNMPDOPTS="-Lsd -Lf /dev/null -p $SNMP_PID"
 # Cd to / before starting any daemons.
 cd /
 
+status=0
+
 case "$1" in
   start)
-    log_daemon_msg "Starting SNMP services:"
+    log_daemon_msg "Starting SNMP services"
     # remove old symlink with previous version
     if [ -L /var/run/agentx ]; then
 	    rm -f /var/run/agentx
@@ -45,36 +47,40 @@ case "$1" in
 	    mkdir -p /var/run/agentx
     fi
     if [ "$SNMPDRUN" = "yes" -a -f /etc/snmp/snmpd.conf ]; then
+	log_progress_msg "snmpd"
 	start-stop-daemon --quiet --start --oknodo --exec /usr/sbin/snmpd \
-	    -- $SNMPDOPTS
-	log_progress_msg " snmpd"
+	    -- $SNMPDOPTS || status=$?
     fi
+    log_end_msg $status
     ;;
   stop)
-    log_daemon_msg "Stopping SNMP services:"
-    start-stop-daemon --quiet --stop --oknodo --retry 3 --exec /usr/sbin/snmpd && [ ! -f $SNMP_PID ] || rm $SNMP_PID
-    log_progress_msg " snmpd"
+    log_daemon_msg "Stopping SNMP services" "snmpd"
+    start-stop-daemon --quiet --stop --oknodo --retry 3 --exec /usr/sbin/snmpd || status=$?
+    [ $status -eq 0 -a -f $SNMP_PID ] && rm $SNMP_PID
+    log_end_msg $status
     ;;
   restart)
-    log_daemon_msg "Restarting SNMP services:"
-    start-stop-daemon --quiet --stop --oknodo --retry 3 --exec /usr/sbin/snmpd  && [ ! -f $SNMP_PID ] || rm $SNMP_PID
+    log_daemon_msg "Restarting SNMP services"
+    start-stop-daemon --quiet --stop --oknodo --retry 3 --exec /usr/sbin/snmpd || status=$?
+    [ $status -eq 0 -a -f $SNMP_PID ] && rm $SNMP_PID
     if [ "$SNMPDRUN" = "yes" -a -f /etc/snmp/snmpd.conf ]; then
-	start-stop-daemon --quiet --start --exec /usr/sbin/snmpd -- $SNMPDOPTS
-	log_progress_msg " snmpd"
+	log_progress_msg "snmpd"
+	start-stop-daemon --quiet --start --exec /usr/sbin/snmpd -- $SNMPDOPTS || status=$?
     fi
+    log_end_msg $status
     ;;
   reload|force-reload)
-    log_daemon_msg "Reloading SNMP services:"
+    log_daemon_msg "Reloading SNMP services"
     if [ "$SNMPDRUN" = "yes" -a -f /etc/snmp/snmpd.conf ]; then
+	log_progress_msg "snmpd"
         start-stop-daemon --quiet --stop --signal 1 \
-	    --pidfile "$SNMP_PID" --exec /usr/sbin/snmpd
-	log_progress_msg " snmpd"
+	    --pidfile "$SNMP_PID" --exec /usr/sbin/snmpd || status=$?
     fi
+    log_end_msg $status
     ;;
   status)
-    status=0
     if [ "$SNMPDRUN" = "yes" -a -f /etc/snmp/snmpd.conf ]; then
-    	status_of_proc /usr/sbin/snmpd snmpd || status=$?
+	status_of_proc /usr/sbin/snmpd snmpd || status=$?
     fi
     exit $status
     ;;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-net-snmp/pkg-net-snmp.git



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