index 52bf7433c8a4732b0251ad4a3ee65f3821aa807f..829eda5fcdc4d3c553f3c38d8c7a075aa4149c9d 100644 (file)
service="collectd"
CONFIG=/etc/collectd.conf
COLLECTD=/usr/sbin/collectd
-COLLECTDMONPIDIR="/var/run"
-COLLECTDMONPID="$COLLECTDMONPIDIR/collectdmon.pid"
+COLLECTDMONPIDDIR="/var/run"
+COLLECTDMONPID="$COLLECTDMONPIDDIR/collectdmon.pid"
+
+MAXWAIT=30
if [ -r /etc/sysconfig/$service ]; then
. /etc/sysconfig/$service
fi
-if [ ! -d $COLLECTDMONPIDIR ]; then
- mkdir -p $COLLECTDMONPIDIR
- [ -n "${RUNAS-}" ] && chown $RUNAS: $COLLECTDMONPIDIR
+if [[ ! -d $COLLECTDMONPIDDIR ]]; then
+ mkdir -p $COLLECTDMONPIDDIR
+ [ -n "${RUNAS}" ] && chown "${RUNAS}:" "$COLLECTDMONPIDDIR"
fi
check_config() {
return 0
}
-
start () {
echo -n $"Starting collectd: "
check_config
echo $"not starting due to configuration error"
failure $"not starting $service due to configuration error"
else
- daemon --user "${RUNAS-root}" $prog -P $COLLECTDMONPID -c $COLLECTD -- -C "$CONFIG" $ARGS
+ daemon --user "${RUNAS:-root}" $prog -P $COLLECTDMONPID -c $COLLECTD -- -C "$CONFIG" $ARGS
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/$service
fi
}
+
stop () {
echo -n $"Stopping collectd: "
- killproc -p $COLLECTDMONPID $prog
+ killproc -p $COLLECTDMONPID -d $MAXWAIT $prog
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$service
}
+
+restart () {
+ check_config
+ rc="$?"
+ if test "$rc" -ne 0; then
+ RETVAL=6
+ echo $"not restarting due to configuration error"
+ failure $"not restarting $service due to configuration error"
+ else
+ stop
+ start
+ fi
+}
+
# See how we were called.
case "$1" in
start)
status -p $COLLECTDMONPID $prog
;;
restart|reload)
- check_config
- rc="$?"
- if test "$rc" -ne 0; then
- RETVAL=6
- echo $"not restarting due to configuration error"
- failure $"not restarting $service due to configuration error"
- else
- stop
- start
- fi
+ restart
;;
condrestart)
[ -f /var/lock/subsys/$service ] && restart || :