2 # script to check accessibility to the reclock file on a node
4 [ -n "$CTDB_BASE" ] || \
5 CTDB_BASE=$(d=$(dirname "$0") ; cd -P "$d" ; dirname "$PWD")
7 . "${CTDB_BASE}/functions"
11 ctdb_setup_state_dir "service" "reclock"
13 ctdb_get_reclock_option ()
15 _reclock_opt_file="${CTDB_SCRIPT_VARDIR}/recovery_lock.cache"
17 if [ -f "$_reclock_opt_file" ] ; then
18 . "$_reclock_opt_file"
22 ctdb_translate_option "cluster" \
24 "CTDB_RECOVERY_LOCK" >"$_reclock_opt_file"
26 . "$_reclock_opt_file"
29 ctdb_get_reclock_option
31 # If CTDB_RECOVERY_LOCK specifies a helper then exit because this
32 # script can't do anything useful.
33 case "$CTDB_RECOVERY_LOCK" in
41 if [ -n "$CTDB_RECOVERY_LOCK" ] ; then
42 d=$(dirname "$CTDB_RECOVERY_LOCK")
48 # Early exit if not using a reclock file
49 [ -n "$CTDB_RECOVERY_LOCK" ] || exit 0
51 # Try to stat the reclock file as a background process so that
52 # we don't block in case the cluster filesystem is unavailable
54 if stat "$CTDB_RECOVERY_LOCK" ; then
55 # We could stat the file, reset the counter
61 num_fails=$(ctdb_counter_get)
62 if [ "$num_fails" -ge 200 ] ; then
63 echo "Reclock file \"$CTDB_RECOVERY_LOCK\" can not be accessed. Shutting down."
68 elif [ "$num_fails" -ge 4 ] ; then
69 die "ERROR: ${num_fails} consecutive failures checking reclock"