eventscripts: Each script should set CTDB_BASE if it is not set
authorMartin Schwenke <martin@meltin.net>
Thu, 3 Jan 2013 04:26:12 +0000 (15:26 +1100)
committerAmitay Isaacs <amitay@gmail.com>
Tue, 8 Jan 2013 04:18:46 +0000 (15:18 +1100)
This makes it easier to run the scripts externally.

Signed-off-by: Martin Schwenke <martin@meltin.net>
19 files changed:
config/events.d/00.ctdb
config/events.d/01.reclock
config/events.d/10.interface
config/events.d/11.natgw
config/events.d/11.routing
config/events.d/13.per_ip_routing
config/events.d/20.multipathd
config/events.d/31.clamd
config/events.d/40.fs_use
config/events.d/40.vsftpd
config/events.d/41.httpd
config/events.d/49.winbind
config/events.d/50.samba
config/events.d/60.ganesha
config/events.d/60.nfs
config/events.d/62.cnfs
config/events.d/70.iscsi
config/events.d/91.lvs
config/events.d/99.timeout

index 2f2116d061a01ae8f0326060c7d90fc286492326..847805bc64dad157231c0aa19a517b021626a43c 100755 (executable)
@@ -9,6 +9,9 @@
 #     releaseip  : called when an IP address is released
 #     recovered  : called when ctdb has finished a recovery event
 
+[ -n "$CTDB_BASE" ] || \
+    export CTDB_BASE=$(cd -P $(dirname "$0") ; dirname "$PWD")
+
 . $CTDB_BASE/functions
 loadconfig
 
index 345a63150ffe14be4fbecb9c3f13fd7c7d4d9d3c..a3bfc66c1d5e2a06345670231e7a2632b3cf054e 100755 (executable)
@@ -1,6 +1,9 @@
 #!/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
 
index 7a85892c7c6515d9b0ed1cfbb76ccca6bd606abd..caff9faa254a735093aea0dcecea4f4fc3be386c 100755 (executable)
@@ -5,6 +5,9 @@
 # this adds/removes IPs from your 
 # public interface
 
+[ -n "$CTDB_BASE" ] || \
+    export CTDB_BASE=$(cd -P $(dirname "$0") ; dirname "$PWD")
+
 . $CTDB_BASE/functions
 loadconfig
 
index 30b8c70d1e99de642e41e8427627a6cf64e055bd..12ba9ca03638de668477c4307c159a3bf1ae0ccc 100755 (executable)
@@ -5,6 +5,9 @@
 # available.
 #
 
+[ -n "$CTDB_BASE" ] || \
+    export CTDB_BASE=$(cd -P $(dirname "$0") ; dirname "$PWD")
+
 . $CTDB_BASE/functions
 loadconfig
 
index 38a0258c603c558df9e29b2e980694ebdf8d0d4a..f3e972b16d4c27690756b4a310c29f8ed81df27d 100755 (executable)
@@ -12,6 +12,9 @@
 # Example
 # bond1 10.3.3.0/24 10.0.0.1
 
+[ -n "$CTDB_BASE" ] || \
+    export CTDB_BASE=$(cd -P $(dirname "$0") ; dirname "$PWD")
+
 . $CTDB_BASE/functions
 loadconfig
 
index d51d309dd80b4c43e1a4038834ccad3dd7734e30..fe97ffc586d2c26b01f9ffbb146ea2d2279d37bf 100755 (executable)
@@ -1,5 +1,8 @@
 #!/bin/sh
 
+[ -n "$CTDB_BASE" ] || \
+    export CTDB_BASE=$(cd -P $(dirname "$0") ; dirname "$PWD")
+
 . $CTDB_BASE/functions
 loadconfig
 
index 1bf7070fb58e5fba640e8009080eb5da918bb79b..c2956d24a1144a9b3991136197095dd5185c2d3a 100755 (executable)
@@ -6,6 +6,9 @@
 #   CTDB_MONITOR_MPDEVICES="device1 device2 ..."
 #
 
+[ -n "$CTDB_BASE" ] || \
+    export CTDB_BASE=$(cd -P $(dirname "$0") ; dirname "$PWD")
+
 . $CTDB_BASE/functions
 
 service_name="multipathd"
index 53739e24f39ca08558acbcb7f82736d854de2115..15751a9c60104f4352ab0fd4410a402951e18d52 100755 (executable)
@@ -1,6 +1,9 @@
 #!/bin/sh
 # event script to manage clamd in a cluster environment
 
+[ -n "$CTDB_BASE" ] || \
+    export CTDB_BASE=$(cd -P $(dirname "$0") ; dirname "$PWD")
+
 . $CTDB_BASE/functions
 
 detect_init_style
index 7dd4cc3ad659b13df04b76499ed048e44860b815..603b4635fa9bc480b0ebc5c981ffc85f779fd07f 100644 (file)
@@ -1,6 +1,9 @@
 #!/bin/sh
 # ctdb event script for checking local file system utilization
 
+[ -n "$CTDB_BASE" ] || \
+    export CTDB_BASE=$(cd -P $(dirname "$0") ; dirname "$PWD")
+
 . $CTDB_BASE/functions
 loadconfig
 
index ab23a802309259d8c3a1e3d366fe1e4a3b858f0d..25964b87031fd36d8ec3ed547f86f35c9ddfa6be 100755 (executable)
@@ -1,6 +1,9 @@
 #!/bin/sh
 # event strict to manage vsftpd in a cluster environment
 
+[ -n "$CTDB_BASE" ] || \
+    export CTDB_BASE=$(cd -P $(dirname "$0") ; dirname "$PWD")
+
 . $CTDB_BASE/functions
 
 service_name="vsftpd"
index 4fb6aa06101aaae3f2d824967f638785ddf2a9e9..3baa784acb60331f30d941d7a0f913297cf1a3c8 100755 (executable)
@@ -1,6 +1,9 @@
 #!/bin/sh
 # event script to manage httpd in a cluster environment
 
+[ -n "$CTDB_BASE" ] || \
+    export CTDB_BASE=$(cd -P $(dirname "$0") ; dirname "$PWD")
+
 . $CTDB_BASE/functions
 
 detect_init_style
index cd360a9c1015a23ca48b8a887192e1eacdf79432..d0a154d0bc069096cfca927c40888a40a0ce3002 100755 (executable)
@@ -1,6 +1,9 @@
 #!/bin/sh
 # ctdb event script for winbind
 
+[ -n "$CTDB_BASE" ] || \
+    export CTDB_BASE=$(cd -P $(dirname "$0") ; dirname "$PWD")
+
 . $CTDB_BASE/functions
 
 detect_init_style
index 3a43bbe471eb673f13e88ba640280f2bca252d71..ecbe05e8e763e3b9c024bbc7aea55cc300569b65 100755 (executable)
@@ -1,6 +1,9 @@
 #!/bin/sh
 # ctdb event script for Samba
 
+[ -n "$CTDB_BASE" ] || \
+    export CTDB_BASE=$(cd -P $(dirname "$0") ; dirname "$PWD")
+
 . $CTDB_BASE/functions
 
 detect_init_style
index a685013954ec3d66a5ee796785ed00e142942358..4d8736e2db9bff5099a1fdc788f54cd87fdb68a2 100755 (executable)
@@ -1,6 +1,9 @@
 #!/bin/sh
 # script to manage nfs in a clustered environment
 
+[ -n "$CTDB_BASE" ] || \
+    export CTDB_BASE=$(cd -P $(dirname "$0") ; dirname "$PWD")
+
 . $CTDB_BASE/functions
 
 service_name="nfs-ganesha-gpfs"
index 69a99dc1e6b251e583ee2f35787617dbf1998dd8..2cba9a76f49af5addb49f85739a6ba1616caa51f 100755 (executable)
@@ -1,6 +1,9 @@
 #!/bin/sh
 # script to manage nfs in a clustered environment
 
+[ -n "$CTDB_BASE" ] || \
+    export CTDB_BASE=$(cd -P $(dirname "$0") ; dirname "$PWD")
+
 . $CTDB_BASE/functions
 
 service_name="nfs"
index 3cc56e39555c1fe08f07f030cfce0b685d2d28c1..302b497cfd514987539bb9eaa2d7f750a8822a12 100755 (executable)
@@ -1,6 +1,9 @@
 #!/bin/sh
 # event script to integrate with gpfs cnfs
 
+[ -n "$CTDB_BASE" ] || \
+    export CTDB_BASE=$(cd -P $(dirname "$0") ; dirname "$PWD")
+
 . $CTDB_BASE/functions
 
 loadconfig
index a05025923d5b86d0a7f31de3bc81a3e265587c70..6b588b5a7f9b12a7c21f9154a0aebf6c04e36648 100755 (executable)
@@ -1,6 +1,9 @@
 #!/bin/sh
 # ctdb event script for TGTD based iSCSI
 
+[ -n "$CTDB_BASE" ] || \
+    export CTDB_BASE=$(cd -P $(dirname "$0") ; dirname "$PWD")
+
 . $CTDB_BASE/functions
 
 service_name="iscsi"
index beba98d57768af109c5fb11159db101fa075a495..c1e6d15604615dd4ac5817e1eaa5354cd609a3d6 100755 (executable)
@@ -1,6 +1,9 @@
 #!/bin/sh
 # script to manage the lvs ip multiplexer for a single public address cluster
 
+[ -n "$CTDB_BASE" ] || \
+    export CTDB_BASE=$(cd -P $(dirname "$0") ; dirname "$PWD")
+
 . $CTDB_BASE/functions
 
 loadconfig ctdb
index 7a47c8dd8166179f2b0c07bdf69167e1011b1ae1..258366a7e725ada518c90d5ff6d1fa340eac6797 100755 (executable)
@@ -4,6 +4,9 @@
 # in the monitor action. The purpose is to trigger
 # the event timeout mechanism.
 
+[ -n "$CTDB_BASE" ] || \
+    export CTDB_BASE=$(cd -P $(dirname "$0") ; dirname "$PWD")
+
 . $CTDB_BASE/functions
 loadconfig ctdb