From: Martin Schwenke Date: Wed, 6 Jul 2016 04:24:18 +0000 (+1000) Subject: ctdb-scripts: Drop use of ctdb_check_counter from httpd event script X-Git-Tag: tdb-1.3.10~279 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=92d0d4489e9dff41b3af419ebdfb71ea15e9ea60;p=thirdparty%2Fsamba.git ctdb-scripts: Drop use of ctdb_check_counter from httpd event script This makes the logic more obvious. Signed-off-by: Martin Schwenke Reviewed-by: Amitay Isaacs --- diff --git a/ctdb/config/events.d/41.httpd b/ctdb/config/events.d/41.httpd index 7e3e3e3bccc..4a55231c48a 100755 --- a/ctdb/config/events.d/41.httpd +++ b/ctdb/config/events.d/41.httpd @@ -58,22 +58,21 @@ shutdown) monitor) if ctdb_check_tcp_ports 80 >/dev/null 2>/dev/null ; then - ctdb_counter_init + ctdb_counter_init else - ctdb_counter_incr - - ctdb_check_counter warn -eq 2 || { - echo "HTTPD is not running. Trying to restart HTTPD." - service_stop - service_start - exit 0 - } - ctdb_check_counter warn -ge 5 || { - echo "HTTPD is not running. Trying to restart HTTPD." - service_stop - service_start - exit 1 - } + ctdb_counter_incr + num_fails=$(ctdb_counter_get) + if [ "$num_fails" -eq 2 ] ; then + echo "HTTPD is not running. Trying to restart HTTPD." + service_stop + service_start + exit 0 + elif [ "$num_fails" -ge 5 ] ; then + echo "HTTPD is not running. Trying to restart HTTPD." + service_stop + service_start + exit 1 + fi fi ;; esac