*
* Kern Sibbald, March MM
*
- * Version $Id$
*/
#include "bacula.h"
void init_device_resources();
static char *runjob = NULL;
-static int background = 1;
+static bool background = true;
static void init_reload(void);
static CONFIG *config;
" -dt print timestamp in debug output\n"
" -f run in foreground (for debugging)\n"
" -g groupid\n"
+" -m print kaboom output (for debugging)\n"
" -r <job> run <job> now\n"
" -s no signals\n"
" -t test - read configuration and exit\n"
/*********************************************************************
*
- * Main Bacula Server program
+ * Main Bacula Director Server program
*
*/
#if defined(HAVE_WIN32)
console_command = run_console_command;
- while ((ch = getopt(argc, argv, "c:d:fg:r:stu:v?")) != -1) {
+ while ((ch = getopt(argc, argv, "c:d:fg:mr:stu:v?")) != -1) {
switch (ch) {
case 'c': /* specify config file */
if (configfile != NULL) {
break;
case 'f': /* run in foreground */
- background = FALSE;
+ background = false;
break;
case 'g': /* set group id */
gid = optarg;
break;
+ case 'm': /* print kaboom output */
+ prt_kaboom = true;
+ break;
+
case 'r': /* run job */
if (runjob != NULL) {
free(runjob);
if (background) {
daemon_start();
init_stack_dump(); /* grab new pid */
- }
-
+ }
/* Create pid must come after we are a daemon -- so we have our final pid */
- create_pid_file(director->pid_directory, "bacula-dir", get_first_port_host_order(director->DIRaddrs));
- read_state_file(director->working_directory, "bacula-dir", get_first_port_host_order(director->DIRaddrs));
+ create_pid_file(director->pid_directory, "bacula-dir",
+ get_first_port_host_order(director->DIRaddrs));
+ read_state_file(director->working_directory, "bacula-dir",
+ get_first_port_host_order(director->DIRaddrs));
}
+ set_jcr_in_tsd(INVALID_JCR);
+ set_thread_concurrency(director->MaxConcurrentJobs * 2 +
+ 4 /* UA */ + 5 /* sched+watchdog+jobsvr+misc */);
+ lmgr_init_thread(); /* initialize the lockmanager stack */
+
load_dir_plugins(director->plugin_directory);
drop(uid, gid, false); /* reduce privileges if requested */
init_python_interpreter(&python_args);
#endif /* HAVE_PYTHON */
- set_jcr_in_tsd(INVALID_JCR);
- set_thread_concurrency(director->MaxConcurrentJobs * 2 +
- 4 /* UA */ + 4 /* sched+watchdog+jobsvr+misc */);
-
Dmsg0(200, "Start UA server\n");
start_UA_server(director->DIRaddrs);
init_job_server(director->MaxConcurrentJobs);
- dbg_jcr_add_hook(_dbg_print_db); /* used to debug B_DB connexion after fatal signal */
+ dbg_jcr_add_hook(db_debug_print); /* used to debug B_DB connexion after fatal signal */
// init_device_resources();
* Hook all active jobs so that they release this table
*/
foreach_jcr(jcr) {
- if (jcr->get_JobType() != JT_SYSTEM) {
+ if (jcr->getJobType() != JT_SYSTEM) {
reload_table[table].job_count++;
job_end_push(jcr, reload_job_end_cb, (void *)((long int)table));
njobs++;
OK = false;
continue;
}
+
+ /* Display a message if the db max_connections is too low */
+ if (!db_check_max_connections(NULL, db, director->MaxConcurrentJobs+1)) {
+ Pmsg1(000, "Warning, settings problem for Catalog=%s\n", catalog->name());
+ Pmsg1(000, "%s", db_strerror(db));
+ }
/* we are in testing mode, so don't touch anything in the catalog */
if (mode == CHECK_CONNECTION) {
}
bstrncpy(sr.Name, store->name(), sizeof(sr.Name));
sr.AutoChanger = store->autochanger;
- db_create_storage_record(NULL, db, &sr);
+ if (!db_create_storage_record(NULL, db, &sr)) {
+ Jmsg(NULL, M_FATAL, 0, _("Could not create storage record for %s\n"),
+ store->name());
+ OK = false;
+ }
store->StorageId = sr.StorageId; /* set storage Id */
if (!sr.created) { /* if not created, update it */
sr.AutoChanger = store->autochanger;
- db_update_storage_record(NULL, db, &sr);
+ if (!db_update_storage_record(NULL, db, &sr)) {
+ Jmsg(NULL, M_FATAL, 0, _("Could not update storage record for %s\n"),
+ store->name());
+ OK = false;
+ }
}
/* tls_require implies tls_enable */
if (mode == UPDATE_AND_FIX) {
db_sql_query(db, cleanup_created_job, NULL, NULL);
db_sql_query(db, cleanup_running_job, NULL, NULL);
- db_sql_query(db, "CREATE INDEX basefiles_jobid_idx ON BaseFiles ( JobId )" , NULL, NULL);
}
db_close_database(NULL, db);