]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
ctdb-scripts: Drop use of ctdb_check_counter from httpd event script
authorMartin Schwenke <martin@meltin.net>
Wed, 6 Jul 2016 04:24:18 +0000 (14:24 +1000)
committerAmitay Isaacs <amitay@samba.org>
Thu, 21 Jul 2016 00:24:25 +0000 (02:24 +0200)
This makes the logic more obvious.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/config/events.d/41.httpd

index 7e3e3e3bccc8a4bd5638e3c071b6ed699c753cd2..4a55231c48a050b7d4c243a4fe4f7968fb4bc77b 100755 (executable)
@@ -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