summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 6934b3d)
raw | patch | inline | side by side (parent: 6934b3d)
author | octo <octo> | |
Sat, 11 Mar 2006 15:05:18 +0000 (15:05 +0000) | ||
committer | octo <octo> | |
Sat, 11 Mar 2006 15:05:18 +0000 (15:05 +0000) |
debian/collectd.init.d | patch | blob | history | |
debian/collectd.postinst | patch | blob | history |
diff --git a/debian/collectd.init.d b/debian/collectd.init.d
index c9d950ffc866bedc6ed3f4cad79044775ca88037..0503ec944a8bdc82381f60ca016403f91ed08898 100755 (executable)
--- a/debian/collectd.init.d
+++ b/debian/collectd.init.d
-#!/bin/sh
+#!/bin/bash
#
# collectd Initscript for collectd
# http://verplant.org/collectd/
-# Author: Florian Forster <octo@verplant.org>
-# Extended to support multiple running instances of collectd:
+# Authors: Florian Forster <octo@verplant.org>
# Sebastian Harl <sh@tokkee.org>
#
# Function that starts the daemon/service.
#
d_start() {
- i=1
+ i=0
- if [[ ! -d "$CONFIGDIR" && -e "$FALLBACKCONF" ]]
+ if [ ! -d "$CONFIGDIR" -a -e "$FALLBACKCONF" ]
then
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}' )
+ for FILE in `ls $CONFIGDIR/*.conf 2>/dev/null`
+ do
+ NAME=`basename "$FILE" .conf`
- if [ 1 != $i ]; then
- echo -n " "
+ if [ $i == 0 ]
+ then
+ echo -n " (";
+ else
+ echo -n ", ";
+ fi
+
+ $DAEMON -C "$FILE" 2>/dev/null
+ if [ $? == 0 ]
+ then
+ echo -n "$NAME";
+ else
+ echo -n "$NAME failed";
fi
- start-stop-daemon --start --quiet \
- --pidfile $PIDFILE --startas $DAEMON \
- -- -C "$CONFIGDIR/$CONFIG"
- echo -n "$NAME"
-
- let i++
+ i=$(($i+1))
done
- echo -n ")"
+
+ if [ $i == 0 ]
+ then
+ echo -n "[no config found]";
+ else
+ echo -n ")"
+ fi
fi
}
index d1aa19cbb860bbf133c6eb8868825a145f526ffd..05ce45d17f883a4d5c7877d00fca77a91bded5a1 100755 (executable)
--- a/debian/collectd.postinst
+++ b/debian/collectd.postinst
configure)
[ -d /etc/collectd ] || mkdir -p /etc/collectd
- if [ -e /etc/collectd.conf && ! -e /etc/collectd/default.conf ]; then
+ if [ -e /etc/collectd.conf -a ! -e /etc/collectd/default.conf ]; then
mv /etc/collectd.conf /etc/collectd/default.conf
fi
;;