1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-26 10:04:02 +03:00

50 lines
950 B
Plaintext
Raw Normal View History

#!/bin/sh
# script to check accessibility to the reclock file on a node
[ -n "$CTDB_BASE" ] || \
export CTDB_BASE=$(cd -P $(dirname "$0") ; dirname "$PWD")
. $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