2 # event script to manage httpd in a cluster environment
4 [ -n "$CTDB_BASE" ] || \
5 export CTDB_BASE=$(cd -P $(dirname "$0") ; dirname "$PWD")
11 case $CTDB_INIT_STYLE in
17 service_name="apache2"
18 service_config="apache2"
22 # RHEL5 sometimes use a SIGKILL to terminate httpd, which then leaks
23 # semaphores. This is a hack to clean them up.
24 cleanup_httpd_semaphore_leak() {
25 killall -q -0 "$service_name" ||
26 for i in $(ipcs -s | awk '$3 == "apache" { print $2 }') ; do
35 cleanup_httpd_semaphore_leak
36 service $service_name start
40 service $service_name stop
41 killall -q -9 $service_name || true
46 ctdb_start_stop_service
48 is_ctdb_managed_service || exit 0
60 if ctdb_check_tcp_ports 80 >/dev/null 2>/dev/null ; then
65 ctdb_check_counter warn -eq 2 || {
66 echo "HTTPD is not running. Trying to restart HTTPD."
71 ctdb_check_counter warn -ge 5 || {
72 echo "HTTPD is not running. Trying to restart HTTPD."
81 ctdb_standard_event_handler "$@"