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,
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)
{
} 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",
}
}
- 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) {