summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 327ea9f)
raw | patch | inline | side by side (parent: 327ea9f)
author | tokkee <tokkee> | |
Mon, 6 Mar 2006 20:37:14 +0000 (20:37 +0000) | ||
committer | tokkee <tokkee> | |
Mon, 6 Mar 2006 20:37:14 +0000 (20:37 +0000) |
the init script.
debian/collectd.init.d | patch | blob | history | |
debian/collectd.postinst | [new file with mode: 0755] | patch | blob |
debian/collectd.postrm | [new file with mode: 0755] | patch | blob |
diff --git a/debian/collectd.init.d b/debian/collectd.init.d
index 13118fabf4136d4de344a4b222aa3284727b2a32..c9d950ffc866bedc6ed3f4cad79044775ca88037 100755 (executable)
--- a/debian/collectd.init.d
+++ b/debian/collectd.init.d
# collectd Initscript for collectd
# http://verplant.org/collectd/
# Author: Florian Forster <octo@verplant.org>
+# Extended to support multiple running instances of collectd:
+# Sebastian Harl <sh@tokkee.org>
#
set -e
DAEMON=/usr/sbin/$NAME
SCRIPTNAME=/etc/init.d/$NAME
ARGS=""
-CONFIG=/etc/collectd.conf
+
+CONFIGDIR=/etc/collectd
+# for backward compatibility
+FALLBACKCONF=/etc/collectd.conf
# Gracefully exit if the package has been removed.
test -x $DAEMON || exit 0
# Function that starts the daemon/service.
#
d_start() {
- if [ -e "$CONFIG" ]
+ i=1
+
+ if [[ ! -d "$CONFIGDIR" && -e "$FALLBACKCONF" ]]
then
- start-stop-daemon --start --quiet --exec $DAEMON -- -C "$CONFIG"
+ start-stop-daemon --start --quiet --exec $DAEMON \
+ -- -C "$FALLBACKCONF"
+ else
+ echo -n " ("
+ for CONFIG in `cd $CONFIGDIR; ls *.conf 2> /dev/null`; do
+ CONF="$CONFIGDIR/$CONFIG"
+ NAME=${CONFIG%%.conf}
+ PIDFILE=$( grep PIDFile $CONF | awk '{print $2}' )
+
+ if [ 1 != $i ]; then
+ echo -n " "
+ fi
+
+ start-stop-daemon --start --quiet \
+ --pidfile $PIDFILE --startas $DAEMON \
+ -- -C "$CONFIGDIR/$CONFIG"
+ echo -n "$NAME"
+
+ let i++
+ done
+ echo -n ")"
fi
}
diff --git a/debian/collectd.postinst b/debian/collectd.postinst
--- /dev/null
+++ b/debian/collectd.postinst
@@ -0,0 +1,40 @@
+#!/bin/bash -e
+# postinst script for collectd
+#
+# see: dh_installdeb(1)
+#
+# summary of how this script can be called:
+# * <postinst> `configure' <most-recently-configured-version>
+# * <old-postinst> `abort-upgrade' <new version>
+# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
+# <new-version>
+# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
+# <failed-install-package> <version> `removing'
+# <conflicting-package> <version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+#
+
+case "$1" in
+ configure)
+ [ -d /etc/collectd ] || mkdir -p /etc/collectd
+
+ if [ -e /etc/collectd.conf && ! -e /etc/collectd/default.conf ]; then
+ mv /etc/collectd.conf /etc/collectd/default.conf
+ fi
+ ;;
+
+ abort-upgrade|abort-remove|abort-deconfigure)
+ ;;
+
+ *)
+ echo "postinst called with unknown argument \`$1'" >&2
+ exit 1
+ ;;
+esac
+
+#DEBHELPER#
+
+exit 0
+
+
diff --git a/debian/collectd.postrm b/debian/collectd.postrm
--- /dev/null
+++ b/debian/collectd.postrm
@@ -0,0 +1,41 @@
+#! /bin/sh
+# postrm script for collectd
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+# * <postrm> `remove'
+# * <postrm> `purge'
+# * <old-postrm> `upgrade' <new-version>
+# * <new-postrm> `failed-upgrade' <old-version>
+# * <new-postrm> `abort-install'
+# * <new-postrm> `abort-install' <old-version>
+# * <new-postrm> `abort-upgrade' <old-version>
+# * <disappearer's-postrm> `disappear' <r>overwrit>r> <new-version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+
+case "$1" in
+ purge)
+ rm -rf /var/lib/collectd
+ rm -rf /etc/collectd
+ rm -f /etc/collectd.conf
+ ;;
+
+ remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
+ ;;
+
+ *)
+ echo "postrm called with unknown argument \`$1'" >&2
+ exit 1
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0