summaryrefslogtreecommitdiffstats
path: root/ctdb/server/eventscript.c
diff options
context:
space:
mode:
authorRonnie Sahlberg <ronniesahlberg@gmail.com>2009-04-06 14:03:09 +1000
committerRonnie Sahlberg <ronniesahlberg@gmail.com>2009-04-06 14:03:09 +1000
commita87e6f56ae0d42a6e7644cbab39cc205ce3bb715 (patch)
tree1416585f81a8cbf43a85d221429644b24b6be75b /ctdb/server/eventscript.c
parente5e2f6f8f742e5238a965c61b50b92136effe757 (diff)
downloadsamba-a87e6f56ae0d42a6e7644cbab39cc205ce3bb715.tar.gz
samba-a87e6f56ae0d42a6e7644cbab39cc205ce3bb715.tar.xz
samba-a87e6f56ae0d42a6e7644cbab39cc205ce3bb715.zip
we only need to switch into client mode from the eventscript child if we are running the monitor event
(This used to be ctdb commit 13e2c9044950f21918e4610726e73ed3d8f76920)
Diffstat (limited to 'ctdb/server/eventscript.c')
-rw-r--r--ctdb/server/eventscript.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/ctdb/server/eventscript.c b/ctdb/server/eventscript.c
index 246426a351..a30ac3f961 100644
--- a/ctdb/server/eventscript.c
+++ b/ctdb/server/eventscript.c
@@ -299,19 +299,20 @@ static int ctdb_event_script_v(struct ctdb_context *ctdb, const char *options)
int count;
int is_monitor = 0;
- /* This is running in the forked child process. At this stage
- * we want to switch from being a ctdb daemon into being a client
- * and connect to the local daemon.
- */
- if (switch_from_server_to_client(ctdb) != 0) {
- DEBUG(DEBUG_CRIT, (__location__ "ERROR: failed to switch eventscript child into client mode. shutting down.\n"));
- _exit(1);
- }
-
if (!strcmp(options, "monitor")) {
is_monitor = 1;
}
+
if (is_monitor == 1) {
+ /* This is running in the forked child process. At this stage
+ * we want to switch from being a ctdb daemon into being a
+ * client and connect to the real local daemon.
+ */
+ if (switch_from_server_to_client(ctdb) != 0) {
+ DEBUG(DEBUG_CRIT, (__location__ "ERROR: failed to switch eventscript child into client mode. shutting down.\n"));
+ _exit(1);
+ }
+
if (ctdb_ctrl_event_script_init(ctdb) != 0) {
DEBUG(DEBUG_ERR,(__location__ " Failed to init event script monitoring\n"));
talloc_free(tmp_ctx);