From: Michal Rakowski Date: Fri, 4 Jun 2021 11:47:43 +0000 (+0200) Subject: Fix #7739 About deleting running jobs X-Git-Tag: Release-11.3.2~507 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6aeae17223460aa6856e94ebcee06d44d77c733a;p=thirdparty%2Fbacula.git Fix #7739 About deleting running jobs --- diff --git a/bacula/src/dird/ua_cmds.c b/bacula/src/dird/ua_cmds.c index bd1523988..050771b5e 100644 --- a/bacula/src/dird/ua_cmds.c +++ b/bacula/src/dird/ua_cmds.c @@ -2181,10 +2181,24 @@ static void delete_job(UAContext *ua) static void do_job_delete(UAContext *ua, JobId_t JobId) { char ed1[50]; - edit_int64(JobId, ed1); - purge_jobs_from_catalog(ua, ed1); - ua->send_msg(_("JobId=%s and associated records deleted from the catalog.\n"), ed1); + bool skip_job = false; + + JCR *jcr; + foreach_jcr(jcr) { + if (jcr->JobId == JobId) { + skip_job = true; + break; + } + } + endeach_jcr(jcr); + + if (skip_job) { + ua->send_msg(_("Skipping JobId=%s, job is still running!\n"), ed1); + } else { + purge_jobs_from_catalog(ua, ed1); + ua->send_msg(_("JobId=%s and associated records deleted from the catalog.\n"), ed1); + } }