]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/dird/scheduler.c
This commit was manufactured by cvs2svn to create tag
[bacula/bacula] / bacula / src / dird / scheduler.c
index 9ab02e14ef2d178c36501131975acceeea39f999..ebb63ddec337a0b3db2fd9bc78adba6045687edb 100644 (file)
@@ -118,7 +118,7 @@ JCR *wait_for_next_job(char *job_to_run)
 #ifdef xxxx_debug
       if (runtime > 0) {
         bstrftime(dt, sizeof(dt), runjobs[i].runtime);  
-         Dmsg2(000, "    %s run %s\n", dt, runjobs[i].job->hdr.name);
+         Dmsg2(100, "    %s run %s\n", dt, runjobs[i].job->hdr.name);
       }
 #endif
    }
@@ -157,6 +157,9 @@ JCR *wait_for_next_job(char *job_to_run)
    if (run->msgs) {
       jcr->messages = run->msgs;      /* override messages */
    }
+   if (run->Priority) {
+      jcr->JobPriority = run->Priority;
+   }
    Dmsg0(200, "Leave wait_for_next_job()\n");
    return jcr;
 }
@@ -186,7 +189,7 @@ static void find_runs()
    JOB *job;
    SCHED *sched;
    struct tm tm;
-   int hour, next_hour, minute, mday, wday, month, wpos;
+   int hour, next_hour, minute, mday, wday, month, wom, woy;
 
    Dmsg0(200, "enter find_runs()\n");
    num_runjobs = 0;
@@ -202,7 +205,8 @@ static void find_runs()
    mday = tm.tm_mday - 1;
    wday = tm.tm_wday;
    month = tm.tm_mon;
-   wpos = (tm.tm_mday - 1) / 7; 
+   wom = mday / 7;
+   woy = tm_woy(now);                    /* get week of year */
 
    /* Loop through all jobs */
    LockRes();
@@ -218,7 +222,9 @@ static void find_runs()
          */
         if ((bit_is_set(hour, run->hour) || bit_is_set(next_hour, run->hour)) &&
             (bit_is_set(mday, run->mday) || bit_is_set(wday, run->wday)) && 
-            bit_is_set(month, run->month) && bit_is_set(wpos, run->wpos)) {
+            bit_is_set(month, run->month) && 
+            bit_is_set(wom, run->wom) &&  
+            bit_is_set(woy, run->woy)) {
 
            /* find time (time_t) job is to be run */
            localtime_r(&now, &tm);
@@ -231,7 +237,7 @@ static void find_runs()
            if (bit_is_set(next_hour, run->hour)) {
               tm.tm_hour++;
               if (tm.tm_hour > 23) {
-                 tm.tm_hour = 0;
+                 continue;           /* next day */
               }
               runtime = mktime(&tm);
               add_job(job, run, now, runtime);