int main(int argc, const char *argv[])
{
struct ctdb_context *ctdb = NULL;
- int interactive = 0;
+ int interactive_opt = 0;
+ bool interactive = false;
struct poptOption popt_options[] = {
POPT_AUTOHELP
- { "interactive", 'i', POPT_ARG_NONE, &interactive, 0,
+ { "interactive", 'i', POPT_ARG_NONE, &interactive_opt, 0,
"don't fork, log to stderr", NULL },
POPT_TABLEEND
};
}
}
+ interactive = (interactive_opt != 0);
+
/*
* Configuration file handling
*/
*/
ctdb->db_directory = ctdb_config.dbdir_volatile;
+ ok = directory_exist(ctdb->db_directory);
+ if (! ok) {
+ D_ERR("Volatile database directory %s does not exist\n",
+ ctdb->db_directory);
+ goto fail;
+ }
+
ctdb->db_directory_persistent = ctdb_config.dbdir_persistent;
+ ok = directory_exist(ctdb->db_directory_persistent);
+ if (! ok) {
+ D_ERR("Persistent database directory %s does not exist\n",
+ ctdb->db_directory_persistent);
+ goto fail;
+ }
+
ctdb->db_directory_state = ctdb_config.dbdir_state;
+ ok = directory_exist(ctdb->db_directory_state);
+ if (! ok) {
+ D_ERR("State database directory %s does not exist\n",
+ ctdb->db_directory_state);
+ goto fail;
+ }
if (ctdb_config.lock_debug_script != NULL) {
ret = setenv("CTDB_DEBUG_LOCKS",
fast_start = true;
}
+ /* Don't fork when running in test mode */
+ interactive = interactive || test_mode != NULL;
+
/* start the protocol running (as a child) */
- return ctdb_start_daemon(ctdb, interactive?false:true);
+ return ctdb_start_daemon(ctdb, !interactive);
fail:
talloc_free(ctdb);