]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
Allow to cancel a job in the jobq with the runscript exit status 2
authorEric Bollengier <eric@baculasystems.com>
Mon, 13 Feb 2023 17:11:53 +0000 (18:11 +0100)
committerEric Bollengier <eric@baculasystems.com>
Thu, 14 Sep 2023 11:57:01 +0000 (13:57 +0200)
bacula/src/dird/jobq.c

index 5bc30757a2c96fee4516a0ed873765102ad9c544..586b131d699fdde2ec5b6614a28e0baa910bb2a9 100644 (file)
@@ -572,6 +572,10 @@ void *jobq_server(void *arg)
                   }
                   break;
                case 2:          // skip priority checks
+                  jcr->setJobStatus(JS_Canceled);
+                  Jmsg(jcr, M_FATAL, 0, _("Job canceled from Runscript\n"));
+                  break;
+               case 3:          // skip priority checks
                   jcr->JobPriority = 9999;
                   Jmsg(jcr, M_INFO, 0, _("Job Priority adjusted.\n"));
                   break;
@@ -825,6 +829,10 @@ static bool acquire_resources(JCR *jcr)
 {
    bool skip_this_jcr = false;
 
+   if (jcr->is_canceled()) {
+      return false;
+   }
+
    jcr->acquired_resource_locks = false;
 /*
  * Turning this code off is likely to cause some deadlocks,