/*
Bacula® - The Network Backup Solution
- Copyright (C) 2000-2007 Free Software Foundation Europe e.V.
+ Copyright (C) 2000-2008 Free Software Foundation Europe e.V.
The main author of Bacula is Kern Sibbald, with contributions from
many others, a complete list can be found in the file AUTHORS.
void store_jobtype(LEX *lc, RES_ITEM *item, int index, int pass);
void store_level(LEX *lc, RES_ITEM *item, int index, int pass);
void store_replace(LEX *lc, RES_ITEM *item, int index, int pass);
+void store_migtype(LEX *lc, RES_ITEM *item, int index, int pass);
void init_device_resources();
static char *runjob = NULL;
static int background = 1;
static void init_reload(void);
-
+static CONFIG *config;
+
/* Globals Exported */
DIRRES *director; /* Director resource */
int FDConnectTimeout;
extern RES_TABLE resources[];
extern RES **res_head;
extern RES_ITEM job_items[];
+extern int res_all_size;
#if defined(_MSC_VER)
extern "C" { // work around visual compiler mangling variables
init_reload();
daemon_start_time = time(NULL);
+ console_command = run_console_command;
+
while ((ch = getopt(argc, argv, "c:d:fg:r:stu:v?")) != -1) {
switch (ch) {
case 'c': /* specify config file */
configfile = bstrdup(CONFIG_FILE);
}
- parse_config(configfile);
+ config = new_config_parser();
+ config->init(configfile, NULL, M_ERROR_TERM, (void *)&res_all, res_all_size,
+ r_first, r_last, resources, res_head);
+ config->parse_config();
if (init_crypto() != 0) {
Jmsg((JCR *)NULL, M_ERROR_TERM, 0, _("Cryptography library initialization failed.\n"));
read_state_file(director->working_directory, "bacula-dir", get_first_port_host_order(director->DIRaddrs));
}
+ load_dir_plugins(director->plugin_directory);
+
drop(uid, gid); /* reduce privileges if requested */
if (!check_catalog()) {
exit(1);
}
already_here = true;
+ debug_level = 0; /* turn off debug */
stop_watchdog();
generate_daemon_event(NULL, "Exit");
+ unload_plugins();
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));
term_scheduler();
if (debug_level > 5) {
print_memory_pool_stats();
}
- free_config_resources();
+ config->free_resources();
+ free(config);
+ config = NULL;
term_ua_server();
term_msg(); /* terminate message handler */
cleanup_crypto();
}
Dmsg1(100, "Reload_config njobs=%d\n", njobs);
- reload_table[table].res_table = save_config_resources();
+ reload_table[table].res_table = config->save_resources();
Dmsg1(100, "Saved old config in table %d\n", table);
ok = parse_config(configfile, 0, M_ERROR); /* no exit on error */
Jmsg(NULL, M_ERROR, 0, _("Please correct configuration file: %s\n"), configfile);
Jmsg(NULL, M_ERROR, 0, _("Resetting previous configuration.\n"));
}
- reload_table[rtable].res_table = save_config_resources();
+ reload_table[rtable].res_table = config->save_resources();
/* Now restore old resoure values */
int num = r_last - r_first + 1;
RES **res_tab = reload_table[table].res_table;
job_items[i].handler == store_jobtype ||
job_items[i].handler == store_level ||
job_items[i].handler == store_pint ||
+ job_items[i].handler == store_migtype ||
job_items[i].handler == store_replace) {
def_ivalue = (int *)((char *)(job->jobdefs) + offset);
Dmsg5(400, "Job \"%s\", field \"%s\" def_ivalue=%d item %d offset=%u\n",
* Make sure we can open catalog, otherwise print a warning
* message because the server is probably not running.
*/
- db = db_init_database(NULL, catalog->db_name, catalog->db_user,
+ db = db_init(NULL, catalog->db_driver, catalog->db_name, catalog->db_user,
catalog->db_password, catalog->db_address,
catalog->db_port, catalog->db_socket,
catalog->mult_db_connections);
/* Loop over all pools, defining/updating them in each database */
POOL *pool;
foreach_res(pool, R_POOL) {
- create_pool(NULL, db, pool, POOL_OP_UPDATE); /* update request */
- }
-
- /* Loop over all pools for updating RecyclePool */
- foreach_res(pool, R_POOL) {
- update_pool_recyclepool(NULL, db, pool);
+ /*
+ * If the Pool has a catalog resource create the pool only
+ * in that catalog.
+ */
+ if (!pool->catalog || pool->catalog == catalog) {
+ create_pool(NULL, db, pool, POOL_OP_UPDATE); /* update request */
+ update_pool_recyclepool(NULL, db, pool);
+ }
}
STORE *store;