1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-13 13:18:06 +03:00
samba-mirror/ctdb/config/events.d/99.timeout
Martin Schwenke db25ca69e5 Eventscript argument cleanups and introduction of ctdb_standard_event_handler.
The functions file no longer causes a side-effect by doing a shift.
It also doesn't set a convenience variable for $1.

All eventscripts now explicitly use "$1" in their case statement, as
does the initscript.  The absence of a shift means that the
takeip/releaseip events now explicitly reference $2-$4 rather than
$1-$3.

New function ctdb_standard_event_handler handles the status and
setstatus events, and exits for either of those events.  It is called
via a default case in each eventscript, replacing an explicit status
case where applicable.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 3d55408cbbb3bb71670b80f3dad5639ea0be5b5b)
2009-12-01 17:43:47 +11:00

27 lines
475 B
Bash
Executable File

#!/bin/sh
#
# Event script to just sleep longer than the timeout
# in the monitor action. The purpose is to trigger
# the event timeout mechanism.
. $CTDB_BASE/functions
loadconfig ctdb
[ "$CTDB_RUN_TIMEOUT_MONITOR" = "yes" ] || exit 0
case "$1" in
monitor)
TIMEOUT=$(ctdb listvars | awk '$1 == "EventScriptTimeout" {print $3}')
echo "sleeping for $((TIMEOUT * 2)) seconds..."
sleep $((TIMEOUT * 2))
;;
*)
ctdb_standard_event_handler "$@"
;;
esac
exit 0