1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-28 07:21:54 +03:00
samba-mirror/ctdb/config/events.d/01.reclock
Stefan Metzmacher fd06167caa server: add "init" event
This is needed because the "startup" event runs after the initial recovery,
but we need to do some actions before the initial recovery.

metze

(This used to be ctdb commit e953808449c102258abb6cba6f4abf486dda3b82)
2010-01-20 09:44:36 +01:00

47 lines
861 B
Bash
Executable File

#!/bin/sh
# script to check accessibility to the reclock file on a node
. $CTDB_BASE/functions
loadconfig
case "$1" in
init)
ctdb_counter_init
;;
monitor)
RECLOCKFILE=$(ctdb -Y getreclock)
ctdb_counter_incr
(ctdb_check_counter_limit 200 >/dev/null 2>&1) || {
echo "Reclock file $RECLOCKFILE\" can not be accessed. Shutting down."
df
sleep 1
ctdb shutdown
}
[ -z "$RECLOCKFILE" ] && {
# we are not using a reclock file
ctdb_counter_init
exit 0
}
# try stat the reclock file as a background process
# so that we dont block in case the cluster filesystem is unavailable
(
stat $RECLOCKFILE && {
# we could stat the file, reset the counter
ctdb_counter_init
}
) >/dev/null 2>/dev/null &
ctdb_check_counter_limit 3 quiet
;;
*)
ctdb_standard_event_handler "$@"
;;
esac
exit 0