summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: d70f532)
raw | patch | inline | side by side (parent: d70f532)
author | Sebastian Harl <sh@tokkee.org> | |
Sun, 2 Sep 2007 14:08:53 +0000 (16:08 +0200) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Sun, 2 Sep 2007 14:08:53 +0000 (16:08 +0200) |
* Closes: #422208.
* Added collectd.default.
* Added collectd.default.
debian/changelog | patch | blob | history | |
debian/collectd.default | [new file with mode: 0644] | patch | blob |
debian/collectd.init.d | patch | blob | history |
diff --git a/debian/changelog b/debian/changelog
index 83245c09dff5e39ab56005238b23a827689778ba..0f5bd39f99bc791fe14dfd26b6f018738d8a7d1d 100644 (file)
--- a/debian/changelog
+++ b/debian/changelog
- Detailed Linux network interface and routing statistics: netlink
- Values from SNMP enabled network devices: snmp
- Bitrate and frequency of music played with XMMS: xmms
+ * Updated init script to wait for collectd to shut down (Closes: #422208).
- -- Sebastian Harl <sh@tokkee.org> Sun, 2 Sep 2007 00:56:10 +0200
+ -- Sebastian Harl <sh@tokkee.org> Sun, 2 Sep 2007 15:24:40 +0200
collectd (4.0.7-1) experimental; urgency=low
diff --git a/debian/collectd.default b/debian/collectd.default
--- /dev/null
+++ b/debian/collectd.default
@@ -0,0 +1,10 @@
+# /etc/default/collectd
+
+# 0: start collectd on boot, 1: do not start collectd on boot
+# default: 0
+DISABLE=0
+
+# number of seconds to wait for collectd to shut down
+# default: 30
+MAXWAIT=30
+
diff --git a/debian/collectd.init.d b/debian/collectd.init.d
index 5b33322267c75b84f4d5dda64bebc4bde424de29..31d982745897132d08baa4174123d8348da70976 100755 (executable)
--- a/debian/collectd.init.d
+++ b/debian/collectd.init.d
#!/bin/bash
#
-# collectd Initscript for collectd
-# http://collectd.org/
-# Authors: Florian Forster <octo@verplant.org>
-# Sebastian Harl <sh@tokkee.org>
+# collectd - start and stop the statistics collection daemon
+# http://collectd.org/
+#
+# Copyright (C) 2005-2006 Florian Forster <octo@verplant.org>
+# Copyright (C) 2006-2007 Sebastian Harl <sh@tokkee.org>
#
### BEGIN INIT INFO
set -e
PATH=/sbin:/bin:/usr/sbin:/usr/bin
+
+DISABLE=0
+
DESC="statistics collection daemon"
NAME=collectd
-DAEMON=/usr/sbin/$NAME
-SCRIPTNAME=/etc/init.d/$NAME
-ARGS=""
+DAEMON=/usr/sbin/collectd
CONFIGFILE=/etc/collectd/collectd.conf
+PIDFILE=/var/run/collectd.pid
+
+MAXWAIT=30
# Gracefully exit if the package has been removed.
test -x $DAEMON || exit 0
. /etc/default/$NAME
fi
+if test "$DISABLE" != 0; then
+ echo "$NAME has been disabled - see /etc/default/$NAME."
+ exit 0
+fi
+
d_start() {
- if [ -f "$CONFIGFILE" ]; then
- $DAEMON -C $CONFIGFILE 2> /dev/null
- else
- echo ""
- echo "This package is not configured yet. Please refer"
- echo "to /usr/share/doc/collectd/README.Debian for"
- echo "details."
- echo ""
- exit 0
- fi
+ start-stop-daemon --start --quiet --pidfile "$PIDFILE" \
+ --exec $DAEMON -- -C "$CONFIGFILE" -P "$PIDFILE" 2> /dev/null
}
+still_running_warning="
+WARNING: $NAME might still be running.
+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."
+
d_stop() {
- start-stop-daemon --stop --quiet --oknodo --exec $DAEMON
+ PID=$( cat "$PIDFILE" 2> /dev/null ) || true
+
+ start-stop-daemon --stop --quiet --oknodo --pidfile "$PIDFILE"
+
+ sleep 1
+ if test -n "$PID" && kill -0 $PID 2> /dev/null; then
+ i=0
+ while kill -0 $PID 2> /dev/null; do
+ i=$(( $i + 2 ))
+ echo -n " ."
+
+ if test $i -gt $MAXWAIT; then
+ echo "$still_running_warning"
+ return 1
+ fi
+
+ sleep 2
+ done
+ return 0
+ fi
}
case "$1" in
echo "."
;;
*)
- echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
+ echo "Usage: $0 {start|stop|restart|force-reload}" >&2
exit 1
;;
esac
exit 0
# vim: syntax=sh noexpandtab sw=4 ts=4 :
+