summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: a4a177c)
raw | patch | inline | side by side (parent: a4a177c)
author | Sebastian Harl <sh@tokkee.org> | |
Sun, 15 Jul 2012 09:12:29 +0000 (11:12 +0200) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Sun, 15 Jul 2012 09:12:29 +0000 (11:12 +0200) |
Don't exit with an error status in that case. Amongst others, this fixes an
upgrade of collectd when the daemon is disabled.
Thanks to Florian Ernst for reporting this and Evgeni Golov for providing (an
early) patch!
To let those changes to work correctly, don't use 'set -e' and 'exit 0' (at
the end) in order to let return statuses propagate correctly.
Closes: #681216
upgrade of collectd when the daemon is disabled.
Thanks to Florian Ernst for reporting this and Evgeni Golov for providing (an
early) patch!
To let those changes to work correctly, don't use 'set -e' and 'exit 0' (at
the end) in order to let return statuses propagate correctly.
Closes: #681216
debian/changelog | patch | blob | history | |
debian/collectd-core.collectd.init.d | patch | blob | history |
diff --git a/debian/changelog b/debian/changelog
index 23ce540db787e01668fed394bd2d1cc433c5da87..1005cbe672171a4ff8880f6fb96a1c95c0dc4045 100644 (file)
--- a/debian/changelog
+++ b/debian/changelog
- Pass --rrdfilter and --rrdtool parameters to migrate-4-5.px in order to
let the script find those binaries/scripts.
(Closes: #681363)
+ * debian/collectd-core.collectd.init.d:
+ - Catch disabled state in start and restart and don't exit with an error
+ status. Amongst others, this fixes an upgrade of collectd when the
+ daemon is disabled. Thanks to Florian Ernst for reporting this and
+ Evgeni Golov for providing (an early) patch (Closes: #681216).
+ - Don't use 'set -e' and 'exit 0' (at the end) in order to let return
+ statuses propagate correctly. (cf. #681216)
-- Sebastian Harl <tokkee@debian.org> Thu, 12 Jul 2012 18:57:04 +0200
index 991d8b8a17f35a356b76708e35139ac6c77d5e39..dc582e4fa433d931f4848eb27e6550f2ecc24d89 100755 (executable)
# the values in a variety of ways.
### END INIT INFO
-set -e
-
. /lib/lsb/init-functions
export PATH=/sbin:/bin:/usr/sbin:/usr/bin
. /etc/default/$NAME
fi
-if test "$DISABLE" != 0 -a "$1" == "start"; then
- log_warning_msg "Not starting $DESC, disabled by /etc/default/$NAME."
- exit 0
-fi
-
-if test ! -e "$CONFIGFILE" -a "$1" == "start"; then
- log_warning_msg "Not starting $DESC, no configuration ($CONFIGFILE) found."
- exit 0
-fi
-
if test "$ENABLE_COREFILES" == 1; then
ulimit -c unlimited
fi
_PIDFILE="$PIDFILE"
fi
+# return:
+# 0 if config is fine
+# 1 if there is a syntax error
+# 2 if there is no configuration
check_config() {
+ if test ! -e "$CONFIGFILE"; then
+ return 2
+ fi
if ! $DAEMON -t -C "$CONFIGFILE"; then
return 1
fi
+ return 0
}
+# return:
+# 0 if the daemon has been started
+# 1 if the daemon was already running
+# 2 if the daemon could not be started
+# 3 if the daemon was not supposed to be started
d_start() {
if test "$DISABLE" != 0; then
# we get here during restart
log_progress_msg "disabled by /etc/default/$NAME"
- return 2
+ return 3
fi
if test ! -e "$CONFIGFILE"; then
# we get here during restart
log_progress_msg "disabled, no configuration ($CONFIGFILE) found"
- return 2
+ return 3
fi
check_config
rc="$?"
- if test "$rc" -eq 1; then
+ if test "$rc" -ne 0; then
log_progress_msg "not starting, configuration error"
return 2
fi
--exec $DAEMON -- -C "$CONFIGFILE" -P "$_PIDFILE" \
|| return 2
fi
+ return 0
}
still_running_warning="
In large setups it might take some time to write all pending data to
the disk. You can adjust the waiting time in /etc/default/collectd."
+# return:
+# 0 if the daemon has been stopped
+# 1 if the daemon was already stopped
+# 2 if daemon could not be stopped
d_stop() {
PID=$( cat "$_PIDFILE" 2> /dev/null ) || true
case "$?" in
0|1) log_end_msg 0 ;;
2) log_end_msg 1 ;;
+ 3) log_end_msg 255; true ;;
+ *) log_end_msg 1 ;;
esac
;;
stop)
d_start
rc2="$?"
case "$rc2" in
- 0) log_end_msg 0 ;;
+ 0|1) log_end_msg 0 ;;
+ 2) log_end_msg 1 ;;
+ 3) log_end_msg 255; true ;;
*) log_end_msg 1 ;;
esac
;;
;;
esac
-exit 0
-
# vim: syntax=sh noexpandtab sw=4 ts=4 :