/* Main loop -- call scheduler to get next job to run */
while ((jcr = wait_for_next_job(runjob))) {
run_job(jcr); /* run job */
- if (runjob) /* command line, run a single job? */
+ if (runjob) { /* command line, run a single job? */
break; /* yes, terminate */
+ }
}
terminate_dird(0);
{
int stat, errstat;
+ init_msg(jcr, jcr->msgs);
create_unique_job_name(jcr, jcr->job->hdr.name);
jcr->jr.SchedTime = jcr->sched_time;
jcr->jr.StartTime = jcr->start_time;
/* Initialize termination condition variable */
if ((errstat = pthread_cond_init(&jcr->term_wait, NULL)) != 0) {
- Emsg1(M_FATAL, 0, _("Unable to init job cond variable: ERR=%s\n"), strerror(errstat));
+ Jmsg1(jcr, M_FATAL, 0, _("Unable to init job cond variable: ERR=%s\n"), strerror(errstat));
jcr->JobStatus = JS_ErrorTerminated;
free_jcr(jcr);
return;
jcr->pool = job->pool;
jcr->catalog = job->client->catalog;
jcr->fileset = job->fs;
- init_msg(jcr, job->messages);
+ jcr->msgs = job->messages;
/* If no default level given, set one */
if (jcr->level == 0) {
switch (jcr->JobType) {
if (job_to_run) { /* one shot */
job = (JOB *)GetResWithName(R_JOB, job_to_run);
if (!job) {
- Emsg1(M_ERROR, 0, _("Job %s not found\n"), job_to_run);
+ Emsg1(M_ABORT, 0, _("Job %s not found\n"), job_to_run);
}
Dmsg1(5, "Found job_to_run %s\n", job_to_run);
jcr = new_jcr(sizeof(JCR), dird_free_jcr);
rem_runjobs--; /* decrement count of remaining jobs */
jcr = new_jcr(sizeof(JCR), dird_free_jcr);
+ ASSERT(job);
+ sm_check(__FILE__, __LINE__, False);
set_jcr_defaults(jcr, job);
if (run->level) {
jcr->level = run->level; /* override run level */
free_pool_memory(cmd);
free_msgs_res(msgs);
+ msgs = NULL;
}
/*