1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-05 21:57:51 +03:00

41.httpd event script workaround for RHEL5-ism.

RHEL5 can SIGKILL httpd when stopping it, causing it to leak
semaphores.  This means that eventually a node runs out of semaphores
and httpd can't be started.  So, before we attempt to start httpd we
clean up any semaphores owned by apache.  We also try to restart httpd
in the monitor event if httpd has gone away.

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

(This used to be ctdb commit 2d3fbbbb63f443686f9fec42c0bc2058d115806e)
This commit is contained in:
Martin Schwenke 2009-05-11 14:50:28 +10:00 committed by Ronnie Sahlberg
parent 54a5e6c0c8
commit 86ad711c37

View File

@ -34,19 +34,35 @@ loadconfig "${CTDB_CONFIG_HTTP}"
cmd="$1"
shift
case $cmd in
startup)
service "${CTDB_SERVICE_HTTP}" stop > /dev/null 2>&1
service "${CTDB_SERVICE_HTTP}" start
;;
# 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 "${CTDB_SERVICE_HTTP}" ||
for i in $(ipcs -s | awk '$3 == "apache" { print $2 }') ; do
ipcrm -s $i
done
}
shutdown)
service "${CTDB_SERVICE_HTTP}" stop
;;
case $cmd in
startup)
cleanup_httpd_semaphore_leak
service "${CTDB_SERVICE_HTTP}" start
;;
shutdown)
service "${CTDB_SERVICE_HTTP}" stop
killall -q -9 "${CTDB_SERVICE_HTTP}"
;;
monitor)
ctdb_check_tcp_ports "http" 80
;;
( ctdb_check_tcp_ports "http" 80 )
if [ $? -ne 0 ] ; then
echo "HTTPD is not running. Trying to restart HTTPD."
cleanup_httpd_semaphore_leak
service "${CTDB_SERVICE_HTTP}" start
exit 1
fi
;;
esac
exit 0