From 93d58a6ba151d068781d7e1afef5b9ad4ee13b50 Mon Sep 17 00:00:00 2001 From: Eric Bollengier Date: Sun, 1 Oct 2006 21:04:05 +0000 Subject: [PATCH] ebl fix RunScript bug (in some case, After script wasn't launched) git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@3528 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/filed/job.c | 7 +++++++ bacula/src/jcr.h | 1 + 2 files changed, 8 insertions(+) diff --git a/bacula/src/filed/job.c b/bacula/src/filed/job.c index 0c81adc143..3182907008 100644 --- a/bacula/src/filed/job.c +++ b/bacula/src/filed/job.c @@ -230,6 +230,11 @@ void *handle_client_request(void *dirp) } } + if (!jcr->runscript_after) { + jcr->runscript_after=1; + run_scripts(jcr, jcr->RunScripts, "ClientAfterJob"); + } + /* Inform Storage daemon that we are done */ if (jcr->store_bsock) { bnet_sig(jcr->store_bsock, BNET_TERMINATE); @@ -1369,12 +1374,14 @@ static int backup_cmd(JCR *jcr) Dmsg0(110, "Error in blast_data.\n"); /* run shortly after end of data transmission */ run_scripts(jcr, jcr->RunScripts, "ClientAfterJob"); + jcr->runscript_after=1; } else { set_jcr_job_status(jcr, JS_Terminated); /* run shortly after end of data transmission */ run_scripts(jcr, jcr->RunScripts, "ClientAfterJob"); + jcr->runscript_after=1; if (jcr->JobStatus != JS_Terminated) { bnet_suppress_error_messages(sd, 1); diff --git a/bacula/src/jcr.h b/bacula/src/jcr.h index 6a2dad36e4..c13da9f9da 100644 --- a/bacula/src/jcr.h +++ b/bacula/src/jcr.h @@ -276,6 +276,7 @@ public: int32_t pki_session_encoded_size; /* Size of DER-encoded pki_session */ POOLMEM *crypto_buf; /* Encryption/Decryption buffer */ DIRRES* director; /* Director resource */ + bool runscript_after; /* Don't run After Script twice */ #endif /* FILE_DAEMON */ -- 2.39.5