X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=bacula%2Fsrc%2Fdird%2Fjobq.c;h=97917b676b79c4d7f782316d6c76851e8792faa3;hb=b12d66d61e0319cbff0ada8f77dda6bc91c40bbf;hp=c9d055e5e24b0f6f796d7f3ce369646126b6bf7a;hpb=7112b523db04b96da94caf08b5f4e2dea259955f;p=bacula%2Fbacula diff --git a/bacula/src/dird/jobq.c b/bacula/src/dird/jobq.c index c9d055e5e2..97917b676b 100644 --- a/bacula/src/dird/jobq.c +++ b/bacula/src/dird/jobq.c @@ -612,15 +612,23 @@ void *jobq_server(void *arg) */ static bool reschedule_job(JCR *jcr, jobq_t *jq, jobq_item_t *je) { + bool resched = false; /* - * Reschedule the job if necessary and requested + * Reschedule the job if requested and possible */ - if (jcr->job->RescheduleOnError && - jcr->JobStatus != JS_Terminated && - jcr->JobStatus != JS_Canceled && - jcr->getJobType() == JT_BACKUP && - (jcr->job->RescheduleTimes == 0 || - jcr->reschedule_count < jcr->job->RescheduleTimes)) { + /* Basic condition is that more times remain */ + if (jcr->job->RescheduleTimes == 0 || + jcr->reschedule_count < jcr->job->RescheduleTimes) { + resched = + /* Check for incomplete jobs */ + (jcr->job->RescheduleIncompleteJobs && jcr->is_incomplete()) || + /* Check for failed jobs */ + (jcr->job->RescheduleOnError && + jcr->JobStatus != JS_Terminated && + jcr->JobStatus != JS_Canceled && + jcr->getJobType() == JT_BACKUP); + } + if (resched) { char dt[50], dt2[50]; /* @@ -645,6 +653,7 @@ static bool reschedule_job(JCR *jcr, jobq_t *jq, jobq_item_t *je) if (!allow_duplicate_job(jcr)) { return false; } + /* Only jobs with no output or Incomplete jobs can run on same JCR */ if (jcr->JobBytes == 0 || jcr->incomplete) { Dmsg2(2300, "Requeue job=%d use=%d\n", jcr->JobId, jcr->use_count()); V(jq->mutex);