summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ctdb/include/ctdb_private.h1
-rw-r--r--ctdb/server/ctdb_takeover.c10
-rw-r--r--ctdb/server/ctdbd.c15
3 files changed, 10 insertions, 16 deletions
diff --git a/ctdb/include/ctdb_private.h b/ctdb/include/ctdb_private.h
index 967dd63c9a0..3430f9cd01d 100644
--- a/ctdb/include/ctdb_private.h
+++ b/ctdb/include/ctdb_private.h
@@ -1219,7 +1219,6 @@ int ctdb_set_single_public_ip(struct ctdb_context *ctdb,
const char *iface,
const char *ip);
int ctdb_set_event_script(struct ctdb_context *ctdb, const char *script);
-int ctdb_set_event_script_dir(struct ctdb_context *ctdb, const char *script_dir);
int ctdb_set_notification_script(struct ctdb_context *ctdb, const char *script);
int ctdb_takeover_run(struct ctdb_context *ctdb, struct ctdb_node_map *nodemap,
uint32_t *force_rebalance_nodes,
diff --git a/ctdb/server/ctdb_takeover.c b/ctdb/server/ctdb_takeover.c
index ecb0dbe5fab..91f30302d77 100644
--- a/ctdb/server/ctdb_takeover.c
+++ b/ctdb/server/ctdb_takeover.c
@@ -1135,16 +1135,6 @@ static int ctdb_add_public_address(struct ctdb_context *ctdb,
return 0;
}
-/*
- setup the event script directory
-*/
-int ctdb_set_event_script_dir(struct ctdb_context *ctdb, const char *script_dir)
-{
- ctdb->event_script_dir = talloc_strdup(ctdb, script_dir);
- CTDB_NO_MEMORY(ctdb, ctdb->event_script_dir);
- return 0;
-}
-
static void ctdb_check_interfaces_event(struct event_context *ev, struct timed_event *te,
struct timeval t, void *private_data)
{
diff --git a/ctdb/server/ctdbd.c b/ctdb/server/ctdbd.c
index b04971760d4..f19b48ff2ed 100644
--- a/ctdb/server/ctdbd.c
+++ b/ctdb/server/ctdbd.c
@@ -54,7 +54,7 @@ static struct {
} options = {
.nlist = NULL,
.transport = "tcp",
- .event_script_dir = ETCDIR "/ctdb/events.d",
+ .event_script_dir = NULL,
.logfile = LOGDIR "/log.ctdb",
.db_dir = VARDIR "/ctdb",
.db_dir_persistent = VARDIR "/ctdb/persistent",
@@ -296,10 +296,15 @@ int main(int argc, const char *argv[])
}
}
- ret = ctdb_set_event_script_dir(ctdb, options.event_script_dir);
- if (ret == -1) {
- DEBUG(DEBUG_ALERT,("Unable to setup event script directory\n"));
- exit(1);
+ if (options.event_script_dir != NULL) {
+ ctdb->event_script_dir = options.event_script_dir;
+ } else {
+ ctdb->event_script_dir = talloc_asprintf(ctdb, "%s/events.d",
+ getenv("CTDB_BASE"));
+ if (ctdb->event_script_dir == NULL) {
+ DEBUG(DEBUG_ALERT,(__location__ " Out of memory\n"));
+ exit(1);
+ }
}
if (options.notification_script != NULL) {