3 # ctdbd wrapper - start or stop CTDB
7 echo "usage: ctdbd_wrapper { start | stop }"
15 ############################################################
17 if [ -z "$CTDB_BASE" ] ; then
18 export CTDB_BASE="/usr/local/etc/ctdb"
21 . "${CTDB_BASE}/functions"
23 load_system_config "ctdb"
25 ctdbd="${CTDBD:-/usr/local/sbin/ctdbd}"
27 ############################################################
31 eval "$ctdbd" || return 1
33 # Wait until ctdbd has started and is ready to respond to clients.
34 _timeout="${CTDB_STARTUP_TIMEOUT:-10}"
36 while [ "$_count" -lt "$_timeout" ] ; do
37 if $CTDB runstate first_recovery startup running >/dev/null 2>&1 ; then
41 _count=$((_count + 1))
45 echo "Timed out waiting for initialisation - check logs"
46 # Attempt a shutdown just in case things are still running
47 $CTDB shutdown >/dev/null 2>&1
48 drop_all_public_ips >/dev/null 2>&1
56 # The above command is important and needs to stand out, so
57 # post-check exit status
58 # shellcheck disable=SC2181
59 if [ $? -ne 0 ] ; then
60 echo "Error while shutting down CTDB"
61 drop_all_public_ips >/dev/null 2>&1
68 ############################################################
70 # Allow notifications for start/stop.
71 if [ -x "$CTDB_BASE/rc.ctdb" ] ; then
72 "$CTDB_BASE/rc.ctdb" "$action"
79 echo "usage: $0 {start|stop}"