From: Eric Bollengier Date: Mon, 13 Feb 2023 17:11:53 +0000 (+0100) Subject: Allow to cancel a job in the jobq with the runscript exit status 2 X-Git-Tag: Beta-15.0.0~259 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=27cd61206e17b207169610585ed2f3f65025870c;p=thirdparty%2Fbacula.git Allow to cancel a job in the jobq with the runscript exit status 2 --- diff --git a/bacula/src/dird/jobq.c b/bacula/src/dird/jobq.c index 5bc30757a..586b131d6 100644 --- a/bacula/src/dird/jobq.c +++ b/bacula/src/dird/jobq.c @@ -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,