1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-14 19:24:43 +03:00
Martin Schwenke 73cb65bf1a Eventscripts: Untested factorisations and introduction of status event.
This is the first stage of an experimental change to eventscripts.
Ronnie and I did a few hours of factorisation of 40.vsftpd and applied
many of the changes to 41.httpd.  Other eventscripts were also
modified.

At this stage this is completely untested.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 364e70b763f0ccd7714d15723ad3ea4d7e2968a1)
2009-11-13 18:28:25 +11:00

63 lines
1.1 KiB
Bash
Executable File

#!/bin/sh
# event script to manage httpd in a cluster environment
. $CTDB_BASE/functions
detect_init_style
case $CTDB_INIT_STYLE in
redhat)
service_name="httpd"
service_config="http"
;;
suse|debian|*)
service_name="apache2"
service_config="apache2"
;;
esac
# RHEL5 sometimes use a SIGKILL to terminate httpd, which then leaks
# semaphores. This is a hack to clean them up.
cleanup_httpd_semaphore_leak() {
killall -q -0 "$service_name" ||
for i in $(ipcs -s | awk '$3 == "apache" { print $2 }') ; do
ipcrm -s $i
done
}
##########
service_start="cleanup_httpd_semaphore_leak; service $service_name start"
service_stop="service $service_name stop; killall -q -9 $service_name"
service_reconfigure="service $service_name restart"
loadconfig
ctdb_start_stop_service
case $cmd in
startup)
ctdb_service_start
;;
shutdown)
ctdb_service_stop
;;
monitor)
if ctdb_service_needs_reconfigure ; then
ctdb_service_reconfigure
exit 0
fi
if ! ctdb_check_tcp_ports 80 ; then
echo "HTTPD is not running. Trying to restart HTTPD."
ctdb_service_start
exit 1
fi
;;
esac
exit 0