File collectd.suse.init of Package collectd
#! /bin/sh
# Author: Pascal Bleser <guru@unixtech.be>
# Please send feedback to guru@unixtech.be
#
# /etc/init.d/collectd
# and its symbolic link
# /usr/sbin/rccollectd
#
### BEGIN INIT INFO
# Provides: collectd
# Required-Start: $local_fs $remote_fs $network
# Required-Stop: $local_fs $remote_fs $network
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Short-Description: Collectd daemon collecting system statistics
# Description: Start Collectd to collect system statistics
### END INIT INFO
# Check for missing binaries (stale symlinks should not happen)
# Note: Special treatment of stop for LSB conformance
COLLECTD_BIN=/usr/sbin/collectd
test -x $COLLECTD_BIN || { echo "$COLLECTD_BIN not installed";
if [ "$1" = "stop" ]; then exit 0;
else exit 5; fi; }
# Check for existence of needed config file and read it
COLLECTD_CONFIG=/etc/collectd.conf
test -r $COLLECTD_CONFIG || { echo "$COLLECTD_CONFIG not existing";
if [ "$1" = "stop" ]; then exit 0;
else exit 6; fi; }
SERVICENAME=collectd
. /etc/rc.status
# Reset status of this service
rc_reset
case "$1" in
start)
echo -n "Starting $SERVICENAME "
/sbin/startproc "$COLLECTD_BIN"
rc_status -v
;;
stop)
echo -n "Shutting down $SERVICENAME "
/sbin/killproc -TERM "$COLLECTD_BIN"
rc_status -v
;;
try-restart|condrestart)
## Do a restart only if the service was active before.
## Note: try-restart is now part of LSB (as of 1.9).
## RH has a similar command named condrestart.
if test "$1" = "condrestart"; then
echo "${attn} Use try-restart ${done}(LSB)${attn} rather than condrestart ${warn}(RH)${norm}"
fi
$0 status
if test $? = 0; then
$0 restart
else
rc_reset # Not running is not a failure.
fi
rc_status
;;
restart)
$0 stop
$0 start
rc_status
;;
force-reload)
echo -n "Reload service $SERVICENAME "
$0 try-restart
rc_status
;;
reload)
rc_failed 3
rc_status -v
;;
status)
echo -n "Checking for service $SERVICENAME "
/sbin/checkproc $COLLECTD_BIN
rc_status -v
;;
probe)
## Optional: Probe for the necessity of a reload, print out the
## argument to this init script which is required for a reload.
## Note: probe is not (yet) part of LSB (as of 1.9)
test "$COLLECTD_CONFIG" -nt "/var/run/collectd.pid" && echo reload
;;
*)
echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|probe}"
exit 1
;;
esac
rc_exit