From: Marc Fournier Date: Fri, 5 Dec 2014 12:52:09 +0000 (+0100) Subject: redhat initscript: move restart block to a function X-Git-Tag: collectd-5.4.2~4 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=6c72fa02608cc4be8febc4ae3fec809d281536f8;p=collectd.git redhat initscript: move restart block to a function This ensures the "condrestart" option will work. --- 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 || :