From 6c72fa02608cc4be8febc4ae3fec809d281536f8 Mon Sep 17 00:00:00 2001 From: Marc Fournier Date: Fri, 5 Dec 2014 13:52:09 +0100 Subject: [PATCH] redhat initscript: move restart block to a function This ensures the "condrestart" option will work. --- contrib/redhat/init.d-collectd | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/contrib/redhat/init.d-collectd b/contrib/redhat/init.d-collectd index 4c69f3c9..829eda5f 100644 --- a/contrib/redhat/init.d-collectd +++ b/contrib/redhat/init.d-collectd @@ -42,7 +42,6 @@ check_config() { return 0 } - start () { echo -n $"Starting collectd: " check_config @@ -58,6 +57,7 @@ start () { [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$service fi } + stop () { echo -n $"Stopping collectd: " killproc -p $COLLECTDMONPID -d $MAXWAIT $prog @@ -65,6 +65,20 @@ stop () { 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) @@ -77,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 || : -- 2.11.0