parse_config(configfile);
if (!check_resources()) {
- Jmsg(NULL, M_ERROR_TERM, 0, "Please correct configuration file: %s\n", configfile);
+ Jmsg((JCR *)NULL, M_ERROR_TERM, 0, _("Please correct configuration file: %s\n"), configfile);
}
if (test_config) {
}
/* Reset globals */
- working_directory = director->working_directory;
+ set_working_directory(director->working_directory);
FDConnectTimeout = director->FDConnectTimeout;
SDConnectTimeout = director->SDConnectTimeout;
Without that I don't know who I am :-(\n"), configfile);
OK = FALSE;
} else {
- if (!director->working_directory) {
- Jmsg(NULL, M_FATAL, 0, _("No working directory specified. Cannot continue.\n"));
- OK = FALSE;
- }
- working_directory = director->working_directory;
+ set_working_directory(director->working_directory);
if (!director->messages) { /* If message resource not specified */
director->messages = (MSGS *)GetNextRes(R_MSGS, NULL);
if (!director->messages) {
catalog->db_password, catalog->db_address,
catalog->db_port, catalog->db_socket);
if (!db_open_database(NULL, db)) {
- Jmsg(NULL, M_FATAL, 0, "%s", db_strerror(db));
+ Jmsg(NULL, M_FATAL, 0, _("Could not open %s database \"%s\".\n"),
+ catalog_db, catalog->db_name);
+ OK = FALSE;
} else {
/* If a pool is defined for this job, create the pool DB
* record if it is not already created.
*/
if (job->pool) {
- create_pool(NULL, db, job->pool, 0); /* update request */
+ create_pool(NULL, db, job->pool, POOL_OP_UPDATE); /* update request */
+ }
+ /* Set default value in all counters */
+ for (COUNTER *counter=NULL; (counter = (COUNTER *)GetNextRes(R_COUNTER, (RES *)counter)); ) {
+ /* Write to catalog? */
+ if (!counter->created && counter->Catalog == catalog) {
+ COUNTER_DBR cr;
+ bstrncpy(cr.Counter, counter->hdr.name, sizeof(cr.Counter));
+ cr.MinValue = counter->MinValue;
+ cr.MaxValue = counter->MaxValue;
+ cr.CurrentValue = counter->MinValue;
+ bstrncpy(cr.WrapCounter, counter->WrapCounter->hdr.name, sizeof(cr.WrapCounter));
+ if (db_create_counter_record(NULL, db, &cr)) {
+ counter->CurrentValue = cr.CurrentValue;
+ counter->created = true;
+// Dmsg2(000, "Create counter %s val=%d\n", counter->hdr.name, counter->CurrentValue);
+ }
+ } else {
+ counter->CurrentValue = counter->MinValue; /* default value */
+ }
}
db_close_database(NULL, db);
}