]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/dird/scheduler.c
Ensure that StorageId is updated after write
[bacula/bacula] / bacula / src / dird / scheduler.c
index 7f24fb5c9947a4034a0a8dae2d1c9400b350e013..154cc8d05c4fdc91b5ba69b480252cd00eafe534 100644 (file)
@@ -1,12 +1,12 @@
 /*
    Bacula® - The Network Backup Solution
 
-   Copyright (C) 2000-2007 Free Software Foundation Europe e.V.
+   Copyright (C) 2000-2011 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.
    This program is Free Software; you can redistribute it and/or
-   modify it under the terms of version two of the GNU General Public
+   modify it under the terms of version three of the GNU Affero General Public
    License as published by the Free Software Foundation and included
    in the file LICENSE.
 
@@ -15,7 +15,7 @@
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    General Public License for more details.
 
-   You should have received a copy of the GNU General Public License
+   You should have received a copy of the GNU Affero General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
@@ -34,7 +34,6 @@
  *
  *     Kern Sibbald, May MM, major revision December MMIII
  *
- *   Version $Id$
  */
 
 #include "bacula.h"
@@ -200,7 +199,7 @@ again:
    ASSERT(job);
    set_jcr_defaults(jcr, job);
    if (run->level) {
-      jcr->JobLevel = run->level;     /* override run level */
+      jcr->setJobLevel(run->level);  /* override run level */
    }
    if (run->pool) {
       jcr->pool = run->pool;          /* override pool */
@@ -233,9 +232,15 @@ again:
    if (run->spool_data_set) {
       jcr->spool_data = run->spool_data;
    }
+   if (run->accurate_set) {     /* overwrite accurate mode */
+      jcr->accurate = run->accurate;
+   }
    if (run->write_part_after_job_set) {
       jcr->write_part_after_job = run->write_part_after_job;
    }
+   if (run->MaxRunSchedTime_set) {
+      jcr->MaxRunSchedTime = run->MaxRunSchedTime;
+   }
    Dmsg0(dbglvl, "Leave wait_for_next_job()\n");
    return jcr;
 }
@@ -261,19 +266,16 @@ static void find_runs()
    JOB *job;
    SCHED *sched;
    struct tm tm;
-   int minute;
    int hour, mday, wday, month, wom, woy;
    /* Items corresponding to above at the next hour */
-   int nh_hour, nh_mday, nh_wday, nh_month, nh_wom, nh_woy, nh_year;
+   int nh_hour, nh_mday, nh_wday, nh_month, nh_wom, nh_woy;
 
    Dmsg0(dbglvl, "enter find_runs()\n");
 
-
    /* compute values for time now */
    now = time(NULL);
    (void)localtime_r(&now, &tm);
    hour = tm.tm_hour;
-   minute = tm.tm_min;
    mday = tm.tm_mday - 1;
    wday = tm.tm_wday;
    month = tm.tm_mon;
@@ -294,9 +296,8 @@ static void find_runs()
    nh_mday = tm.tm_mday - 1;
    nh_wday = tm.tm_wday;
    nh_month = tm.tm_mon;
-   nh_year  = tm.tm_year;
    nh_wom = nh_mday / 7;
-   nh_woy = tm_woy(now);                     /* get week of year */
+   nh_woy = tm_woy(next_hour);              /* get week of year */
 
    Dmsg7(dbglvl, "nh = %x: h=%d m=%d md=%d wd=%d wom=%d woy=%d\n",
          next_hour, nh_hour, nh_month, nh_mday, nh_wday, nh_wom, nh_woy);
@@ -383,19 +384,15 @@ static void add_job(JOB *job, RUN *run, time_t now, time_t runtime)
     */
    if (((runtime - run->last_run) < 61) || ((runtime+59) < now)) {
 #ifdef SCHED_DEBUG
-      char dt[50], dt1[50], dt2[50];
-      bstrftime_nc(dt, sizeof(dt), runtime);
-      bstrftime_nc(dt1, sizeof(dt1), run->last_run);
-      bstrftime_nc(dt2, sizeof(dt2), now);
-      Dmsg7(000, "Drop: Job=\"%s\" run=%s(%x). last_run=%s(%x). now=%s(%x)\n", job->hdr.name, 
-            dt, runtime, dt1, run->last_run, dt2, now);
+      Dmsg4(000, "Drop: Job=\"%s\" run=%lld. last_run=%lld. now=%lld\n", job->hdr.name, 
+            (utime_t)runtime, (utime_t)run->last_run, (utime_t)now);
       fflush(stdout);
 #endif
       return;
    }
 #ifdef SCHED_DEBUG
-   Dmsg4(000, "Add: Job=\"%s\" run=%x last_run=%x now=%x\n", job->hdr.name, 
-            runtime, run->last_run, now);
+   Dmsg4(000, "Add: Job=\"%s\" run=%lld last_run=%lld now=%lld\n", job->hdr.name, 
+            (utime_t)runtime, (utime_t)run->last_run, (utime_t)now);
 #endif
    /* accept to run this job */
    job_item *je = (job_item *)malloc(sizeof(job_item));