/* Forward referenced subroutines */
static void terminate_dird(int sig);
static int check_resources();
-
+static void dir_sql_query(JCR *jcr, const char *cmd);
+
/* Exported subroutines */
extern "C" void reload_config(int sig);
extern void invalidate_schedules();
extern RES_TABLE resources[];
extern RES **res_head;
extern RES_ITEM job_items[];
-extern URES res_all;
+#if defined(_MSC_VER)
+extern "C" { // work around visual compiler mangling variables
+ extern URES res_all;
+}
+#else
+extern URES res_all;
+#endif
#define CONFIG_FILE "./bacula-dir.conf" /* default configuration file */
my_name_is(0, NULL, director->hdr.name); /* set user defined name */
+ /* Plug database interface for library routines */
+ p_sql_query = (sql_query)dir_sql_query;
+
FDConnectTimeout = (int)director->FDConnectTimeout;
SDConnectTimeout = (int)director->SDConnectTimeout;
}
terminate_dird(0);
+
+ return 0;
+}
+
+static void dir_sql_query(JCR *jcr, const char *cmd)
+{
+ if (!jcr || !jcr->db) {
+ return;
+ }
+ db_sql_query(jcr->db, cmd, NULL, NULL);
}
/* Cleanup and then exit */
reload_table[table].res_table = save_config_resources();
Dmsg1(100, "Saved old config in table %d\n", table);
- ok = parse_config(configfile, 0); /* no exit on error */
+ ok = parse_config(configfile, 0, M_ERROR); /* no exit on error */
Dmsg0(100, "Reloaded config file\n");
if (!ok || !check_resources()) {
job->storage->append(st);
}
}
+ /* Handle RunScripts alists specifically */
+ if (jobdefs->RunScripts) {
+ RUNSCRIPT *rs, *elt;
+
+ if (!job->RunScripts) {
+ job->RunScripts = New(alist(10, not_owned_by_alist));
+ }
+
+ foreach_alist(rs, jobdefs->RunScripts) {
+ elt = copy_runscript(rs);
+ job->RunScripts->append(elt); /* we have to free it */
+ }
+ }
/* Transfer default items from JobDefs Resource */
for (i=0; job_items[i].name; i++) {