Package: snmpd
Version: 5.7.2.1~dfsg-5
Severity: normal
Tags: patch
Dear Maintainer,
the start and stop messages from /etc/init.d/snmpd are garbled.
The final "ok" and the line feed is missing. The attached patch
adds the missing calls of log_end_msg so that the start script
works as expected, at least when the auto-start of the snmpd
service is enabled. It also fixes some minor issues in the start
and stop messages like duplicate colons and unnecessary spaces.
I don't know how Debian start scripts should behave when a
service is disabled, so I tried to not change the behavior when
the auto-start of snmpd is disabled.
As I am not very familiar with Debian start script conventions
better double check the changes before using them.
Regards
Uwe
-- System Information:
Debian Release: jessie/sid
APT prefers testing
APT policy: (750, 'testing'), (650, 'unstable'), (1, 'experimental')
Architecture: i386 (x86_64)
Kernel: Linux 3.9-1-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages snmpd depends on:
ii adduser 3.113+nmu3
ii debconf [debconf-2.0] 1.5.52
ii libc6 2.18-4
ii libsnmp-base 5.7.2.1~dfsg-3
ii libsnmp30 5.7.2.1~dfsg-5
ii lsb-base 4.1+Debian12
snmpd recommends no packages.
Versions of packages snmpd suggests:
pn snmptrapd <none>
-- debconf information:
* snmpd/upgradefrom521:
snmpd/upgradefrom36:
diff --git a/init.d/snmpd b/init.d/snmpd
index 3e6dc03..610cfbc 100755
--- a/init.d/snmpd
+++ b/init.d/snmpd
@@ -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,43 @@ 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
;;