Add a 99.timeout event script to trigger monitor timeouts.
authorMichael Adam <obnox@samba.org>
Tue, 3 Nov 2009 19:00:07 +0000 (20:00 +0100)
committerMichael Adam <obnox@samba.org>
Thu, 5 Nov 2009 10:13:47 +0000 (11:13 +0100)
This just sleeps for twice the value of EventScriptTimeout
in the monitor action. It is not run by default, but
can be activated by setting CTDB_RUN_TIMEOUT_MONITOR
in /etc/sysconfig/ctdb .

Michael

config/events.d/99.timeout [new file with mode: 0755]

diff --git a/config/events.d/99.timeout b/config/events.d/99.timeout
new file mode 100755 (executable)
index 0000000..9ef24e6
--- /dev/null
@@ -0,0 +1,24 @@
+#!/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
+
+[ "x$CTDB_RUN_TIMEOUT_MONITOR" = "xyes" ] || exit 0
+
+cmd="$1"
+shift
+
+case $cmd in
+       monitor)
+               TIMEOUT=$(ctdb listvars | grep EventScriptTimeout | awk '{print $3}')
+               echo "sleeping for $((TIMEOUT * 2)) seconds..."
+               sleep $((TIMEOUT * 2))
+               ;;
+esac
+
+exit 0
+