41.HTTPD
authorRonnie Sahlberg <ronniesahlberg@gmail.com>
Tue, 21 Dec 2010 23:27:53 +0000 (10:27 +1100)
committerRonnie Sahlberg <ronniesahlberg@gmail.com>
Tue, 21 Dec 2010 23:31:41 +0000 (10:31 +1100)
Httpd can be very slow to start on some platforms,
wait 5 monitor intervals before we try to restart it if
it has not bound to port 80 yet.
After 10 failed intervals, flag the node as unhealthy.

config/events.d/41.httpd

index 15a35ea1cfad455d68176face856bebd25559065..e94bde3fadd65c3ecc5573dd1697de8616a364d4 100755 (executable)
@@ -52,10 +52,23 @@ case "$1" in
            exit 0
        fi
 
-       if ! ctdb_check_tcp_ports 80 ; then
-           echo "HTTPD is not running. Trying to restart HTTPD."
-           ctdb_service_start
-           exit 1
+       if ctdb_check_tcp_ports 80 >/dev/null 2>/dev/null ; then
+           ctdb_counter_init
+       else
+           ctdb_counter_incr
+
+           ctdb_check_counter_equal 5 || {
+               echo "HTTPD is not running. Trying to restart HTTPD."
+               ctdb_service_stop
+               ctdb_service_start
+               exit 0
+           }
+            ctdb_check_counter_limit 10 quiet|| {
+               echo "HTTPD is not running. Trying to restart HTTPD."
+               ctdb_service_stop
+               ctdb_service_start
+               exit 1
+           }
        fi
        ;;