]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/dird/scheduler.c
11Apr06
[bacula/bacula] / bacula / src / dird / scheduler.c
index b1361ebfa3813066a408fefe42bb18c235777950..80c72f7f0dda2b707bede0379f88c761697eb68c 100644 (file)
@@ -10,7 +10,7 @@
  *   Version $Id$
  */
 /*
-   Copyright (C) 2000-2005 Kern Sibbald
+   Copyright (C) 2000-2006 Kern Sibbald
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License
@@ -88,6 +88,7 @@ JCR *wait_for_next_job(char *one_shot_job_to_run)
    /* Wait until we have something in the
     * next hour or so.
     */
+again:
    while (jobs_to_run->empty()) {
       find_runs();
       if (!jobs_to_run->empty()) {
@@ -99,7 +100,7 @@ JCR *wait_for_next_job(char *one_shot_job_to_run)
 #ifdef  list_chain
    job_item *je;
    foreach_dlist(je, jobs_to_run) {
-      dump_job(je, "Walk queue");
+      dump_job(je, _("Walk queue"));
    }
 #endif
    /*
@@ -109,7 +110,7 @@ JCR *wait_for_next_job(char *one_shot_job_to_run)
    next_job = (job_item *)jobs_to_run->first();
    jobs_to_run->remove(next_job);
 
-   dump_job(next_job, "Dequeued job");
+   dump_job(next_job, _("Dequeued job"));
 
    if (!next_job) {                /* we really should have something now */
       Emsg0(M_ABORT, 0, _("Scheduler logic error\n"));
@@ -127,11 +128,14 @@ JCR *wait_for_next_job(char *one_shot_job_to_run)
    }
    run = next_job->run;               /* pick up needed values */
    job = next_job->job;
-   run->last_run = now;               /* mark as run now */
-
-   dump_job(next_job, "Run job");
-
+   if (job->enabled) {
+      dump_job(next_job, _("Run job"));
+   }
    free(next_job);
+   if (!job->enabled) {
+      goto again;                     /* ignore this job */
+   }
+   run->last_run = now;               /* mark as run now */
 
    jcr = new_jcr(sizeof(JCR), dird_free_jcr);
    ASSERT(job);
@@ -234,7 +238,7 @@ static void find_runs()
    LockRes();
    foreach_res(job, R_JOB) {
       sched = job->schedule;
-      if (sched == NULL) {            /* scheduled? */
+      if (sched == NULL || !job->enabled) { /* scheduled? or enabled? */
          continue;                    /* no, skip this job */
       }
       Dmsg1(1200, "Got job: %s\n", job->hdr.name);
@@ -342,7 +346,7 @@ static void add_job(JOB *job, RUN *run, time_t now, time_t runtime)
       if (ji->runtime > je->runtime ||
           (ji->runtime == je->runtime && ji->Priority > je->Priority)) {
          jobs_to_run->insert_before(je, ji);
-         dump_job(je, "Inserted job");
+         dump_job(je, _("Inserted job"));
          inserted = true;
          break;
       }
@@ -350,11 +354,11 @@ static void add_job(JOB *job, RUN *run, time_t now, time_t runtime)
    /* If place not found in queue, append it */
    if (!inserted) {
       jobs_to_run->append(je);
-      dump_job(je, "Appended job");
+      dump_job(je, _("Appended job"));
    }
 #ifdef SCHED_DEBUG
    foreach_dlist(ji, jobs_to_run) {
-      dump_job(ji, "Run queue");
+      dump_job(ji, _("Run queue"));
    }
    Dmsg0(000, "End run queue\n");
 #endif