From 2c3e089616d7fa356a3c950a13758b23dab0633b Mon Sep 17 00:00:00 2001 From: octo Date: Fri, 16 Dec 2005 12:56:34 +0000 Subject: [PATCH] Merged revision 321 from the trunk to the branches --- ChangeLog | 2 +- Makefile.am | 2 +- contrib/init.d-rh7 | 83 ++++++++++++++++++++++++++++++++++++++++ debian/collectd.init.d | 87 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 172 insertions(+), 2 deletions(-) create mode 100755 contrib/init.d-rh7 create mode 100755 debian/collectd.init.d diff --git a/ChangeLog b/ChangeLog index a5dba072..2194ed80 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,4 @@ -2005-12-07, Version 3.5.0 +2005-12-07, Version 3.5.0 (Revision 321) * A bug in the `load' module under Solaris has been fixed. * The `users' module has been contributed by Sebastian Harl. It counts currently logged in users. diff --git a/Makefile.am b/Makefile.am index 30beb639..d173ee70 100644 --- a/Makefile.am +++ b/Makefile.am @@ -7,6 +7,6 @@ dist-hook: find $(distdir) -type d -name '.svn' | xargs rm -rf install-exec-hook: - $(mkinstalldirs) $(DESTDIR)$(sysconfdir) $(mkinstalldirs) $(DESTDIR)$(localstatedir)/run $(mkinstalldirs) $(DESTDIR)$(localstatedir)/lib/$(PACKAGE_NAME) + $(mkinstalldirs) $(DESTDIR)$(sysconfdir) diff --git a/contrib/init.d-rh7 b/contrib/init.d-rh7 new file mode 100755 index 00000000..ec20d685 --- /dev/null +++ b/contrib/init.d-rh7 @@ -0,0 +1,83 @@ +#!/bin/bash + +# Source function library. +. /etc/init.d/functions + +RETVAL=0 +ARGS="" +prog="collectd" + +if [ -r /etc/default/$prog ]; then + . /etc/default/$prog +fi + +if [ -n "$DATA_DIR" ]; then + ARGS="-D $DATA_DIR" +fi + +if [ -n "$PING_HOST" ]; then + for HOST in $PING_HOST + do + ARGS="$ARGS -p $HOST" + done +fi + +start () { + if [ "x$START_SERVER" = "xyes" ] + then + echo -n $"Starting $prog (server): " + daemon /usr/sbin/collectd -s $ARGS + RETVAL=$? + echo + [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog + fi + if [ "x$START_CLIENT" = "xyes" ] + then + echo -n $"Starting $prog (client): " + daemon /usr/sbin/collectd -c $ARGS + RETVAL=$? + echo + [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog + fi + if [ "x$START_SERVER" != "xyes" -a "x$START_CLIENT" != "xyes" ] + then + echo -n $"Starting $prog: " + daemon /usr/sbin/collectd -l $ARGS + RETVAL=$? + echo + [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog + fi +} +stop () { + echo -n $"Stopping $prog: " + killproc $prog + RETVAL=$? + echo + [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$prog +} +# See how we were called. +case "$1" in + start) + start + ;; + stop) + stop + ;; + status) + status $prog + ;; + restart|reload) + stop + start + ;; + condrestart) + [ -f /var/lock/subsys/$prog ] && restart || : + ;; + *) + echo $"Usage: $0 {start|stop|status|restart|reload|condrestart}" + exit 1 +esac + +exit $? + +# vim:syntax=sh diff --git a/debian/collectd.init.d b/debian/collectd.init.d new file mode 100755 index 00000000..20064715 --- /dev/null +++ b/debian/collectd.init.d @@ -0,0 +1,87 @@ +#!/bin/sh +# +# collectd Initscript for collectd +# http://verplant.org/collectd/ +# Author: Florian Forster +# + +set -e + +PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin +DESC="Statistics collection daemon" +NAME=collectd +DAEMON=/usr/sbin/$NAME +SCRIPTNAME=/etc/init.d/$NAME +ARGS="" + +# Gracefully exit if the package has been removed. +test -x $DAEMON || exit 0 + +if [ -r /etc/default/$NAME ] +then + . /etc/default/$NAME +fi + +if [ -n "$DATA_DIR" ]; then + ARGS="-D $DATA_DIR" +fi + +if [ -n "$PING_HOST" ]; then + for HOST in $PING_HOST + do + ARGS="$ARGS -p $HOST" + done +fi + +# +# Function that starts the daemon/service. +# +d_start() { + if [ "x$START_SERVER" = "xyes" ] + then + $DAEMON -s $ARGS + fi + if [ "x$START_CLIENT" = "xyes" ] + then + $DAEMON -c $ARGS + fi + if [ "x$START_SERVER" != "xyes" -a "x$START_CLIENT" != "xyes" ] + then + start-stop-daemon --start --quiet --exec $DAEMON -- -l $ARGS + fi +} + +# +# Function that stops the daemon/service. +# +d_stop() { + start-stop-daemon --stop --quiet --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 + ;; +esac + +exit 0 + +# vim:syntax=sh -- 2.30.2