2 # script to check accessibility to the reclock file on a node
10 PATH=/usr/bin:/bin:/usr/sbin:/sbin:$PATH
12 # Count the number of intervals that have passed when we have tried to
13 # but failed to stat the reclock file. after third failure the node
14 # becomes unhealthy after the twentieth failure the node we shutdown
16 RECLOCKCOUNT="fail-count"
20 ctdb_counter_init "$RECLOCKCOUNT"
24 ctdb_counter_incr "$RECLOCKCOUNT"
25 ctdb_counter_limit "$RECLOCKCOUNT" 20 && {
26 echo "Reclock file can not be accessed. Shutting down."
31 RECLOCKFILE=`ctdb -Y getreclock`
32 [ -z "$RECLOCKFILE" ] && {
33 # we are not using a reclock file
34 ctdb_counter_init "$RECLOCKCOUNT"
38 # try stat the reclock file as a background process
39 # so that we dont block in case the cluster filesystem is unavailable
41 stat $RECLOCKFILE && {
42 # we could stat the file, reset the counter
43 ctdb_counter_init "$RECLOCKCOUNT"
45 ) >/dev/null 2>/dev/null &
48 ctdb_counter_limit "$RECLOCKCOUNT" 3 && {
49 echo "Reclock file can not be accessed. Mark node UNHEALTHY."