]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
Make Jobs with runscript "Queued" in timeout to wait
authorEric Bollengier <eric@baculasystems.com>
Wed, 8 Mar 2023 15:45:46 +0000 (16:45 +0100)
committerEric Bollengier <eric@baculasystems.com>
Thu, 14 Sep 2023 11:57:01 +0000 (13:57 +0200)
bacula/src/dird/jobq.c

index 586b131d699fdde2ec5b6614a28e0baa910bb2a9..32b687b26fb96c01599465429c244a0d37c6aa11 100644 (file)
@@ -561,16 +561,6 @@ void *jobq_server(void *arg)
                case 0:
                   Jmsg(jcr, M_INFO, 0, _("User defined resources are available.\n"));
                   break;
-               case 1:
-                  if (jcr->getJobStatus() != JS_WaitUser) {
-                     Jmsg(jcr, M_INFO, 0, _("The Job will wait for user defined resources to be available.\n"));
-                  }
-                  jcr->setJobStatus(JS_WaitUser);
-                  if (!job_canceled(jcr)) {
-                     je = jn;            /* point to next waiting job */
-                     continue;
-                  }
-                  break;
                case 2:          // skip priority checks
                   jcr->setJobStatus(JS_Canceled);
                   Jmsg(jcr, M_FATAL, 0, _("Job canceled from Runscript\n"));
@@ -579,9 +569,20 @@ void *jobq_server(void *arg)
                   jcr->JobPriority = 9999;
                   Jmsg(jcr, M_INFO, 0, _("Job Priority adjusted.\n"));
                   break;
-               default:         // Incorrect code, must review the script
-                  jcr->next_qrunscript_execution = -1;
-                  Jmsg(jcr, M_WARNING, 0, _("Incorrect return code %d for user defined resource checking script.\n"), runcode);
+               case 1:          // wait code
+               default:         // Incorrect code, must review the script or maybe it's a timer issue
+                  if (runcode != 1) {
+                     Dmsg1(DT_SCHEDULER, "Incorrect return code %d for user defined resource checking script.\n",
+                           runcode);
+                  }
+                  if (jcr->getJobStatus() != JS_WaitUser) {
+                     Jmsg(jcr, M_INFO, 0, _("The Job will wait for user defined resources to be available.\n"));
+                  }
+                  jcr->setJobStatus(JS_WaitUser);
+                  if (!job_canceled(jcr)) {
+                     je = jn;            /* point to next waiting job */
+                     continue;
+                  }
                   break;
                }
             } else if (jcr->next_qrunscript_execution > 0) {