/*
Bacula® - The Network Backup Solution
- Copyright (C) 2000-2008 Free Software Foundation Europe e.V.
+ Copyright (C) 2000-2009 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.
#include "bacula.h"
#include "dird.h"
+#ifdef HAVE_PYTHON
+
+#undef _POSIX_C_SOURCE
+#include <Python.h>
+
+#include "lib/pythonlib.h"
+
+/* Imported Functions */
+extern PyObject *job_getattr(PyObject *self, char *attrname);
+extern int job_setattr(PyObject *self, char *attrname, PyObject *value);
+
+#endif /* HAVE_PYTHON */
+
/* Forward referenced subroutines */
void terminate_dird(int sig);
static bool check_resources();
bool test_config = false;
char *uid = NULL;
char *gid = NULL;
+#ifdef HAVE_PYTHON
+ init_python_interpreter_args python_args;
+#endif /* HAVE_PYTHON */
start_heap = sbrk(0);
setlocale(LC_ALL, "");
FDConnectTimeout = (int)director->FDConnectTimeout;
SDConnectTimeout = (int)director->SDConnectTimeout;
-
#if !defined(HAVE_WIN32)
signal(SIGHUP, reload_config);
#endif
init_console_msg(working_directory);
- init_python_interpreter(director->name(), director->scripts_directory,
- "DirStartUp");
+#ifdef HAVE_PYTHON
+ python_args.progname = director->name();
+ python_args.scriptdir = director->scripts_directory;
+ python_args.modulename = "DirStartUp";
+ python_args.configfile = configfile;
+ python_args.workingdir = director->working_directory;
+ python_args.job_getattr = job_getattr;
+ python_args.job_setattr = job_setattr;
+
+ 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 */);
init_job_server(director->MaxConcurrentJobs);
+ dbg_jcr_add_hook(_dbg_print_db); /* used to debug B_DB connexion after fatal signal */
+
// init_device_resources();
Dmsg0(200, "wait for next job\n");
while ( (jcr = wait_for_next_job(runjob)) ) {
run_job(jcr); /* run job */
free_jcr(jcr); /* release jcr */
+ set_jcr_in_tsd(INVALID_JCR);
if (runjob) { /* command line, run a single job? */
break; /* yes, terminate */
}
term_msg(); /* terminate message handler */
cleanup_crypto();
close_memory_pool(); /* release free memory in pool */
+ lmgr_cleanup_main();
sm_dump(false);
exit(sig);
}
*/
if (!pool->catalog || pool->catalog == catalog) {
create_pool(NULL, db, pool, POOL_OP_UPDATE); /* update request */
- update_pool_recyclepool(NULL, db, pool);
+ }
+ }
+
+ /* Once they are created, we can loop over them again, updating
+ * references (RecyclePool)
+ */
+ foreach_res(pool, R_POOL) {
+ /*
+ * If the Pool has a catalog resource update the pool only
+ * in that catalog.
+ */
+ if (!pool->catalog || pool->catalog == catalog) {
+ update_pool_references(NULL, db, pool);
}
}
db_create_storage_record(NULL, db, &sr);
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);
}