From 6d01b2f46484d397d87d89af1f2a21da4a321662 Mon Sep 17 00:00:00 2001 From: Sebastian Harl Date: Tue, 17 Sep 2013 07:16:36 +0200 Subject: [PATCH] collectd-core.collectd.init.d: Do not use different PID files for collectd{,mon} MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit … else, a process might be left-over after changing USE_COLLECTDMON and restarting collectd. Thanks to Dennis Hoppe for reporting this. Closes: #704048 --- debian/changelog | 4 ++++ debian/collectd-core.collectd.init.d | 21 +++++++-------------- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/debian/changelog b/debian/changelog index de01646..5c70943 100644 --- a/debian/changelog +++ b/debian/changelog @@ -40,6 +40,10 @@ collectd (5.4.0-1) UNRELEASED; urgency=low - Let libcollectdclient-dev replace/break collectd-dev (<< 5.2.0-1) because it ships files previously shipped by that package; thanks to Andreas Beckmann for reporting this (Closes: #717973). + * debian/collectd-core.collectd.init.d: + - Do not use different PID files for collectd and collectdmon. Else, a + process might be left-over after changing USE_COLLECTDMON and restarting + collectd. Thanks to Dennis Hoppe for reporting this (Closes: #704048). -- Sebastian Harl Thu, 02 May 2013 21:22:46 +0200 diff --git a/debian/collectd-core.collectd.init.d b/debian/collectd-core.collectd.init.d index dc582e4..f18b994 100755 --- a/debian/collectd-core.collectd.init.d +++ b/debian/collectd-core.collectd.init.d @@ -37,7 +37,6 @@ PIDFILE=/var/run/collectd.pid USE_COLLECTDMON=1 COLLECTDMON_DAEMON=/usr/sbin/collectdmon -COLLECTDMON_PIDFILE=/var/run/collectdmon.pid MAXWAIT=30 @@ -52,12 +51,6 @@ if test "$ENABLE_COREFILES" == 1; then ulimit -c unlimited fi -if test "$USE_COLLECTDMON" == 1; then - _PIDFILE="$COLLECTDMON_PIDFILE" -else - _PIDFILE="$PIDFILE" -fi - # return: # 0 if config is fine # 1 if there is a syntax error @@ -98,12 +91,12 @@ d_start() { fi if test "$USE_COLLECTDMON" == 1; then - start-stop-daemon --start --quiet --oknodo --pidfile "$_PIDFILE" \ - --exec $COLLECTDMON_DAEMON -- -P "$_PIDFILE" -- -C "$CONFIGFILE" \ + start-stop-daemon --start --quiet --oknodo --pidfile "$PIDFILE" \ + --exec $COLLECTDMON_DAEMON -- -P "$PIDFILE" -- -C "$CONFIGFILE" \ || return 2 else - start-stop-daemon --start --quiet --oknodo --pidfile "$_PIDFILE" \ - --exec $DAEMON -- -C "$CONFIGFILE" -P "$_PIDFILE" \ + start-stop-daemon --start --quiet --oknodo --pidfile "$PIDFILE" \ + --exec $DAEMON -- -C "$CONFIGFILE" -P "$PIDFILE" \ || return 2 fi return 0 @@ -119,9 +112,9 @@ the disk. You can adjust the waiting time in /etc/default/collectd." # 1 if the daemon was already stopped # 2 if daemon could not be stopped d_stop() { - PID=$( cat "$_PIDFILE" 2> /dev/null ) || true + PID=$( cat "$PIDFILE" 2> /dev/null ) || true - start-stop-daemon --stop --quiet --oknodo --pidfile "$_PIDFILE" + start-stop-daemon --stop --quiet --oknodo --pidfile "$PIDFILE" rc="$?" if test "$rc" -eq 2; then @@ -167,7 +160,7 @@ case "$1" in esac ;; status) - status_of_proc -p "$_PIDFILE" "$DAEMON" "$NAME" && exit 0 || exit $? + status_of_proc -p "$PIDFILE" "$DAEMON" "$NAME" && exit 0 || exit $? ;; restart|force-reload) log_daemon_msg "Restarting $DESC" "$NAME" -- 2.30.2