From 8d3df83d600b3adc0dd68e2a29907f1f84809f6d Mon Sep 17 00:00:00 2001 From: Sebastian Harl Date: Sat, 29 Mar 2008 11:52:16 +0100 Subject: [PATCH] collectd.init.d: Improved handling of the DISABLE option. If the user wants to start collectd ("start" command line option), the option is considered at the beginning of the script. This way we don't print "Starting..." followed by "collectd has been disabled". d_start() then checks the option again to correctly handle a restart. This partly reverts commit 57daeeb0b8f6625978b9fabcc6283b0828ed9997. --- debian/changelog | 4 ++-- debian/collectd.init.d | 10 ++++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/debian/changelog b/debian/changelog index 4101416..525edfc 100644 --- a/debian/changelog +++ b/debian/changelog @@ -6,9 +6,9 @@ collectd (4.3.1-1) unstable; urgency=low migration (Closes: #469336). * New debconf template translations: - de.po, thanks to Kai Wasserbäch (Closes: #469334). - * collectd.init.d: Consider the DISABLE option in d_start() only. + * collectd.init.d: Consider the DISABLE option only when starting collectd. - -- Sebastian Harl Thu, 13 Mar 2008 11:56:38 +0100 + -- Sebastian Harl Sat, 29 Mar 2008 11:39:32 +0100 collectd (4.3.0-2) unstable; urgency=low diff --git a/debian/collectd.init.d b/debian/collectd.init.d index 995a369..bb27de9 100755 --- a/debian/collectd.init.d +++ b/debian/collectd.init.d @@ -44,6 +44,11 @@ if [ -r /etc/default/$NAME ]; then . /etc/default/$NAME fi +if test "$DISABLE" != 0 -a "$1" == "start"; then + echo "$NAME has been disabled - see /etc/default/$NAME." + exit 0 +fi + if test "$ENABLE_COREFILES" == 1; then ulimit -c unlimited fi @@ -56,8 +61,9 @@ fi d_start() { if test "$DISABLE" != 0; then - echo "$NAME has been disabled - see /etc/default/$NAME." - exit 0 + # we get here during restart + echo -n " - disabled by /etc/default/$NAME" + return 0 fi if ! $DAEMON -t -C "$CONFIGFILE" > /dev/null 2>&1; then -- 2.30.2