/ctdb/events.d/01.reclock
http://github.com/brinkman83/bashrc · Shell · 46 lines · 40 code · 4 blank · 2 comment · 1 complexity · c90844e94909aa7a7ca2bb9f9f5a5efe MD5 · raw file
- #!/bin/sh
- # script to check accessibility to the reclock file on a node
- . $CTDB_BASE/functions
- loadconfig
- case "$1" in
- startup)
- 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