Debian Codegraph @

ctdb/config/events/legacy/01.reclock.script

raw
1 #!/bin/sh
2 # script to check accessibility to the reclock file on a node
3
4 [ -n "$CTDB_BASE" ] || \
5 CTDB_BASE=$(d="$(dirname "$0")" && cd -P "$d/../../" && pwd)
6
7 . "${CTDB_BASE}/functions"
8
9 case "$1" in
10 init)
11 recovery_lock=$("${CTDB_HELPER_BINDIR}/ctdb-config" \
12 get cluster "recovery lock")
13 # xshellcheck disable=SC2181
14 # Above is already complicated enough without embedding into "if"
15 case $? in
16 0) : ;;
17 2) exit 0 ;; # ENOENT: not configured
18 *) die "Unexpected error getting recovery lock configuration"
19 esac
20
21 if [ -z "$recovery_lock" ] ; then
22 exit 0
23 fi
24
25 # If a helper is specified then exit because this script can't
26 # do anything useful
27 case "$recovery_lock" in
28 !*) exit 0 ;;
29 esac
30
31 d=$(dirname "$recovery_lock")
32 mkdir -p "$d"
33 ;;
34 esac