static char *runjob = NULL;
static bool foreground = false;
+static bool make_pid_file = true; /* create pid file */
static void init_reload(void);
static CONFIG *config;
static bool test_config = false;
extern dlist store_globals;
extern dlist job_globals;
extern dlist sched_globals;
-extern dlist *daemon_msg_queue;
-extern pthread_mutex_t daemon_msg_queue_mutex;
extern RES_ITEM job_items[];
#if defined(_MSC_VER)
extern "C" { // work around visual compiler mangling variables
" -g groupid\n"
" -m print kaboom output (for debugging)\n"
" -r <job> run <job> now\n"
+ " -P do not create pid file\n"
" -s no signals\n"
" -t test - read configuration and exit\n"
" -u userid\n"
bool no_signals = false;
char *uid = NULL;
char *gid = NULL;
- MQUEUE_ITEM *item = NULL;
/* DELETE ME when bugs in MA1512, MA1632 MA1639 are fixed */
MA1512_reload_job_end_cb = reload_job_end_cb;
init_msg(NULL, NULL); /* initialize message handler */
init_reload();
daemon_start_time = time(NULL);
- /* Setup daemon message queue */
- daemon_msg_queue = New(dlist(item, &item->link));
+ setup_daemon_message_queue();
console_command = run_console_command;
- while ((ch = getopt(argc, argv, "c:d:fg:mr:stu:v?T")) != -1) {
+ while ((ch = getopt(argc, argv, "c:d:fg:mPr:stu:v?T")) != -1) {
switch (ch) {
case 'c': /* specify config file */
if (configfile != NULL) {
prt_kaboom = true;
break;
+ case 'P': /* no pid file */
+ make_pid_file = false;
+ break;
+
case 'r': /* run job */
if (runjob != NULL) {
free(runjob);
if (!test_config) {
/* 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));
+ if (make_pid_file) {
+ 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));
}
if (already_here) {
V(reload_mutex);
if (tries++ > 10) {
- Jmsg(NULL, M_INFO, 0, _("Already doing a reload request, "
+ Qmsg(NULL, M_INFO, 0, _("Already doing a reload request, "
"request ignored.\n"));
return;
}
table = find_free_reload_table_entry();
if (table < 0) {
- Jmsg(NULL, M_ERROR, 0, _("Too many open reload requests. "
- "Request ignored.\n"));
+ Qmsg(NULL, M_ERROR, 0, _("Too many (%d) open reload requests. "
+ "Request ignored.\n"), max_reloads);
goto bail_out;
}
*/
rtable = find_free_reload_table_entry(); /* save new, bad table */
if (rtable < 0) {
- Jmsg(NULL, M_ERROR, 0, _("Please correct configuration file: %s\n"), configfile);
- Jmsg(NULL, M_ERROR_TERM, 0, _("Out of reload table entries. Giving up.\n"));
+ Qmsg(NULL, M_ERROR, 0, _("Please correct configuration file: %s\n"), configfile);
+ Qmsg(NULL, M_ERROR_TERM, 0, _("Out of reload table entries. Giving up.\n"));
} else {
- Jmsg(NULL, M_ERROR, 0, _("Please correct configuration file: %s\n"), configfile);
- Jmsg(NULL, M_ERROR, 0, _("Resetting previous configuration.\n"));
+ Qmsg(NULL, M_ERROR, 0, _("Please correct configuration file: %s\n"), configfile);
+ Qmsg(NULL, M_ERROR, 0, _("Resetting previous configuration.\n"));
}
/* Save broken res_head pointer */
reload_table[rtable].res_head = res_head;
CLIENT *client;
client = GetClientResWithName(cg->name);
if (!client) {
- Jmsg(NULL, M_INFO, 0, _("Client=%s not found. Assuming it was removed!!!\n"), cg->name);
+ Qmsg(NULL, M_INFO, 0, _("Client=%s not found. Assuming it was removed!!!\n"), cg->name);
} else {
client->globals = cg; /* Set globals pointer */
}
STORE *store;
store = GetStoreResWithName(sg->name);
if (!store) {
- Jmsg(NULL, M_INFO, 0, _("Storage=%s not found. Assuming it was removed!!!\n"), sg->name);
+ Qmsg(NULL, M_INFO, 0, _("Storage=%s not found. Assuming it was removed!!!\n"), sg->name);
} else {
store->globals = sg; /* set globals pointer */
Dmsg2(200, "Reload found numConcurrent=%ld for Store %s\n",
JOB *job;
job = GetJobResWithName(jg->name);
if (!job) {
- Jmsg(NULL, M_INFO, 0, _("Job=%s not found. Assuming it was removed!!!\n"), jg->name);
+ Qmsg(NULL, M_INFO, 0, _("Job=%s not found. Assuming it was removed!!!\n"), jg->name);
} else {
job->globals = jg; /* Set globals pointer */
}
SCHED *sched;
sched = GetSchedResWithName(schg->name);
if (!sched) {
- Jmsg(NULL, M_INFO, 0, _("Schedule=%s not found. Assuming it was removed!!!\n"), schg->name);
+ Qmsg(NULL, M_INFO, 0, _("Schedule=%s not found. Assuming it was removed!!!\n"), schg->name);
} else {
sched->globals = schg; /* Set globals pointer */
}
unload_plugins();
if (!test_config) {
write_state_file(director->working_directory, "bacula-dir", get_first_port_host_order(director->DIRaddrs));
- delete_pid_file(director->pid_directory, "bacula-dir", get_first_port_host_order(director->DIRaddrs));
+ if (make_pid_file) {
+ delete_pid_file(director->pid_directory, "bacula-dir", get_first_port_host_order(director->DIRaddrs));
+ }
}
term_scheduler();
term_job_server();
term_msg(); /* terminate message handler */
cleanup_crypto();
- P(daemon_msg_queue_mutex);
- daemon_msg_queue->destroy();
- free(daemon_msg_queue);
- V(daemon_msg_queue_mutex);
+ free_daemon_message_queue();
if (reload_table) {
free(reload_table);
catalog->db_user,
catalog->db_password, catalog->db_address,
catalog->db_port, catalog->db_socket,
- catalog->db_ssl_key, catalog->db_ssl_cert, catalog->db_ssl_ca,
+ catalog->db_ssl_mode, catalog->db_ssl_key,
+ catalog->db_ssl_cert, catalog->db_ssl_ca,
catalog->db_ssl_capath, catalog->db_ssl_cipher,
catalog->mult_db_connections,
catalog->disable_batch_insert);