summaryrefslogtreecommitdiffstats
path: root/ctdb/server/eventscript.c
diff options
context:
space:
mode:
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);