From: Sebastian Harl Date: Sun, 20 May 2007 01:38:36 +0000 (+0200) Subject: collectd.init.d: Only use /etc/collectd/collectd.conf as config file. X-Git-Tag: collectd-4.0.2-1~31 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=9578a292bf8b61b436bda80e1dc8a52c766c3d6c;p=pkg-collectd.git collectd.init.d: Only use /etc/collectd/collectd.conf as config file. Because of the new plugin infrastructure, a single config file suffices. As we're now shipping collection.conf in /etc/collectd/ we do not want the init script to look for multiple config files. --- diff --git a/debian/collectd.init.d b/debian/collectd.init.d index 525b3f5..8e9c981 100755 --- a/debian/collectd.init.d +++ b/debian/collectd.init.d @@ -19,108 +19,63 @@ set -e -PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin +PATH=/sbin:/bin:/usr/sbin:/usr/bin DESC="Statistics collection daemon" NAME=collectd DAEMON=/usr/sbin/$NAME SCRIPTNAME=/etc/init.d/$NAME ARGS="" -CONFIGDIR=/etc/collectd -# for backward compatibility -FALLBACKCONF=/etc/collectd.conf +CONFIGFILE=/etc/collectd/collectd.conf # Gracefully exit if the package has been removed. test -x $DAEMON || exit 0 -if [ -r /etc/default/$NAME ] -then +if [ -r /etc/default/$NAME ]; then . /etc/default/$NAME fi -# -# Function that starts the daemon/service. -# d_start() { - i=0 - - if [ ! -d "$CONFIGDIR" ] - then - if [ -e "$FALLBACKCONF" ] - then - $DAEMON -C "$FALLBACKCONF" 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 + if [ -f "$CONFIGFILE" ]; then + $DAEMON -C $CONFIGFILE 2> /dev/null else - for FILE in `ls $CONFIGDIR/*.conf 2>/dev/null` - do - NAME=`basename "$FILE" .conf` - - 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 - - i=$(($i+1)) - done - - if [ $i == 0 ] - then - echo -n "[no config found]" - exit 1 - else - echo -n ")" - fi + 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 } -# -# Function that stops the daemon/service. -# d_stop() { start-stop-daemon --stop --quiet --oknodo --exec $DAEMON } case "$1" in - start) - echo -n "Starting $DESC: $NAME" - d_start - echo "." - ;; - stop) - echo -n "Stopping $DESC: $NAME" - d_stop - echo "." - ;; - restart|force-reload) - echo -n "Restarting $DESC: $NAME" - d_stop - sleep 1 - d_start - echo "." - ;; - *) - echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2 - exit 1 - ;; + start) + echo -n "Starting $DESC: $NAME" + d_start + echo "." + ;; + stop) + echo -n "Stopping $DESC: $NAME" + d_stop + echo "." + ;; + restart|force-reload) + echo -n "Restarting $DESC: $NAME" + d_stop + sleep 1 + d_start + echo "." + ;; + *) + echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2 + exit 1 + ;; esac exit 0 -# vim: syntax=sh noexpandtab sw=8 ts=8 : +# vim: syntax=sh noexpandtab sw=4 ts=4 :