mirror of
https://github.com/samba-team/samba.git
synced 2025-01-11 05:18:09 +03:00
46684867b1
The underlying change is to allow the cluster mutex argstring to optionally contain a helper command. When the argument string starts with '!' then the first word is the helper command to run. This is now the standard way of changing the helper from the default. CTDB_CLUSTER_MUTEX_HELPER show now only be used to change the location of the default helper when testing. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
56 lines
1.1 KiB
Bash
Executable File
56 lines
1.1 KiB
Bash
Executable File
#!/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
|
|
|
|
# If CTDB_RECOVERY_LOCK specifies a helper then exit because this
|
|
# script can't do anything useful.
|
|
case "$CTDB_RECOVERY_LOCK" in
|
|
!*) exit 0 ;;
|
|
esac
|
|
|
|
case "$1" in
|
|
init)
|
|
ctdb_counter_init
|
|
|
|
if [ -n "$CTDB_RECOVERY_LOCK" ] ; then
|
|
d=$(dirname "$CTDB_RECOVERY_LOCK")
|
|
mkdir -vp "$d"
|
|
fi
|
|
;;
|
|
|
|
monitor)
|
|
# Early exit if not using a reclock file
|
|
[ -n "$CTDB_RECOVERY_LOCK" ] || exit 0
|
|
|
|
# Try to stat the reclock file as a background process so that
|
|
# we don't block in case the cluster filesystem is unavailable
|
|
(
|
|
if stat $CTDB_RECOVERY_LOCK ; then
|
|
# We could stat the file, reset the counter
|
|
ctdb_counter_init
|
|
fi
|
|
) >/dev/null 2>&1 &
|
|
|
|
ctdb_counter_incr
|
|
if ! ctdb_check_counter "quiet" -ge 200 ; then
|
|
echo "Reclock file \"$CTDB_RECOVERY_LOCK\" can not be accessed. Shutting down."
|
|
df
|
|
sleep 1
|
|
ctdb shutdown
|
|
fi
|
|
|
|
ctdb_check_counter "error" -gt 3
|
|
;;
|
|
|
|
*)
|
|
ctdb_standard_event_handler "$@"
|
|
;;
|
|
esac
|
|
|
|
exit 0
|