X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=contrib%2Fredhat%2Finit.d-collectd;h=829eda5fcdc4d3c553f3c38d8c7a075aa4149c9d;hb=master;hp=abdb168f15d28cce78db59ca29589d2ef0a40e5d;hpb=f7818fbc069c641e1ae40280dbd6f33dc613ec3a;p=collectd.git diff --git a/contrib/redhat/init.d-collectd b/contrib/redhat/init.d-collectd index abdb168f..829eda5f 100644 --- a/contrib/redhat/init.d-collectd +++ b/contrib/redhat/init.d-collectd @@ -21,6 +21,8 @@ COLLECTD=/usr/sbin/collectd COLLECTDMONPIDDIR="/var/run" COLLECTDMONPID="$COLLECTDMONPIDDIR/collectdmon.pid" +MAXWAIT=30 + if [ -r /etc/sysconfig/$service ]; then . /etc/sysconfig/$service fi @@ -40,7 +42,6 @@ check_config() { return 0 } - start () { echo -n $"Starting collectd: " check_config @@ -56,13 +57,28 @@ start () { [ $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) @@ -75,16 +91,7 @@ case "$1" in 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 || :