maybe_set "--event-script-dir" "$CTDB_EVENT_SCRIPT_DIR"
maybe_set "--transport" "$CTDB_TRANSPORT"
maybe_set "-d" "$CTDB_DEBUGLEVEL"
- maybe_set "--debug-hung-script" "$CTDB_DEBUG_HUNG_SCRIPT"
maybe_set "--notification-script" "$CTDB_NOTIFY_SCRIPT"
maybe_set "--start-as-disabled" "$CTDB_START_AS_DISABLED" "yes"
maybe_set "--start-as-stopped " "$CTDB_START_AS_STOPPED" "yes"
maybe_set "--max-persistent-check-errors" "$CTDB_MAX_PERSISTENT_CHECK_ERRORS"
}
+export_debug_variables ()
+{
+ export CTDB_DEBUG_HUNG_SCRIPT
+}
+
# Log given message or stdin to either syslog or a CTDB log file
do_log ()
{
build_ctdb_options
+ export_debug_variables
+
# make sure we drop any ips that might still be held if previous
# instance of ctdb got killed with -9 or similar
drop_all_public_ips
bool do_setsched;
void *saved_scheduler_param;
const char *event_script_dir;
- const char *debug_hung_script;
const char *notification_script;
const char *default_public_interface;
pid_t ctdbd_pid;
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_debug_hung_script(struct ctdb_context *ctdb, const char *script);
int ctdb_set_notification_script(struct ctdb_context *ctdb, const char *script);
void lcp2_forcerebalance(struct ctdb_context *ctdb, uint32_t pnn);
int ctdb_takeover_run(struct ctdb_context *ctdb, struct ctdb_node_map *nodemap, client_async_callback fail_callback, void *callback_data);
const char *public_address_list;
const char *event_script_dir;
const char *notification_script;
- const char *debug_hung_script;
const char *logfile;
const char *recovery_lock_file;
const char *db_dir;
.db_dir_persistent = VARDIR "/ctdb/persistent",
.db_dir_state = VARDIR "/ctdb/state",
.script_log_level = DEBUG_ERR,
- .debug_hung_script = ETCDIR "/ctdb/debug-hung-script.sh",
};
int script_log_level;
{ "logfile", 0, POPT_ARG_STRING, &options.logfile, 0, "log file location", "filename" },
{ "nlist", 0, POPT_ARG_STRING, &options.nlist, 0, "node list file", "filename" },
{ "notification-script", 0, POPT_ARG_STRING, &options.notification_script, 0, "notification script", "filename" },
- { "debug-hung-script", 0, POPT_ARG_STRING, &options.debug_hung_script, 0, "debug script for hung eventscripts", "filename" },
{ "listen", 0, POPT_ARG_STRING, &options.myaddress, 0, "address to listen on", "address" },
{ "transport", 0, POPT_ARG_STRING, &options.transport, 0, "protocol transport", NULL },
{ "dbdir", 0, POPT_ARG_STRING, &options.db_dir, 0, "directory for the tdb files", NULL },
}
}
- if (options.debug_hung_script != NULL) {
- ret = ctdb_set_debug_hung_script(ctdb, options.debug_hung_script);
- }
- if (ret == -1) {
- DEBUG(DEBUG_ALERT,("Unable to setup script to debug hung eventscripts\n"));
- exit(1);
- }
-
ctdb->valgrinding = options.valgrinding;
if (options.valgrinding || options.nosetsched) {
ctdb->do_setsched = 0;
}
}
-/*
- setup the script to debug hung eventscripts
-*/
-int ctdb_set_debug_hung_script(struct ctdb_context *ctdb, const char *script)
-{
- ctdb->debug_hung_script = talloc_strdup(ctdb, script);
- CTDB_NO_MEMORY(ctdb, ctdb->debug_hung_script);
- return 0;
-}
-
static void ctdb_run_debug_hung_script(struct ctdb_context *ctdb, struct ctdb_event_script_state *state)
{
struct ctdb_script_wire *current = get_current_script(state);
char *cmd;
pid_t pid;
+ const char * debug_hung_script = ETCDIR "/ctdb/debug-hung-script.sh";
cmd = child_command_string(ctdb, state,
state->from_user, current->name,
struct stat st;
char buf[200];
- if (stat(ctdb->debug_hung_script, &st) != 0) {
- DEBUG(DEBUG_ERR,("Failed to stat the script to debug hung eventscript. Is it not installed correctly? (script:%s)\n", ctdb->debug_hung_script));
+ if (getenv("CTDB_DEBUG_HUNG_SCRIPT") != NULL) {
+ debug_hung_script = getenv("CTDB_DEBUG_HUNG_SCRIPT");
+ }
+
+ if (stat(debug_hung_script, &st) != 0) {
+ DEBUG(DEBUG_ERR,("Failed to stat the script to debug hung eventscript. Is it not installed correctly? (script:%s)\n", debug_hung_script));
ctdb_kill(state->ctdb, state->child, SIGTERM);
_exit(0);
}
if (!(st.st_mode & S_IXUSR)) {
- DEBUG(DEBUG_DEBUG,("Debug script %s is not executable.\n", ctdb->debug_hung_script));
+ DEBUG(DEBUG_DEBUG,("Debug script %s is not executable.\n", debug_hung_script));
ctdb_kill(state->ctdb, state->child, SIGTERM);
_exit(0);
}
- sprintf(buf, "%s %d", ctdb->debug_hung_script, state->child);
+ sprintf(buf, "%s %d", debug_hung_script, state->child);
system(buf);
/* Now we can kill the child */