]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/lib/runscript.c
Apply patch from Marco van Wieringen <mvw@planets.elm.net>
[bacula/bacula] / bacula / src / lib / runscript.c
index 7eaae64e55267deab84323b37ab0cd1705828c95..c2f61aa8c9f16eda770622e047a456c392c63215 100644 (file)
@@ -20,7 +20,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   Bacula® is a registered trademark of John Walker.
+   Bacula® is a registered trademark of Kern Sibbald.
    The licensor of Bacula is the Free Software Foundation Europe
    (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
    Switzerland, email:ftf@fsfeurope.org.
@@ -116,6 +116,8 @@ int run_scripts(JCR *jcr, alist *runscripts, const char *label)
 
    if (strstr(label, NT_("Before"))) {
       when = SCRIPT_Before;
+   } else if (bstrcmp(label, NT_("ClientAfterVSS"))) {
+      when = SCRIPT_AfterVSS;
    } else {
       when = SCRIPT_After;
    }
@@ -142,6 +144,18 @@ int run_scripts(JCR *jcr, alist *runscripts, const char *label)
          }
       }
 
+      if ((script->when & SCRIPT_AfterVSS) && (when & SCRIPT_AfterVSS)) {
+         if ((script->on_success && (jcr->JobStatus == JS_Blocked))
+            || (script->on_failure && job_canceled(jcr))
+            )
+         {
+            Dmsg4(200, "runscript: Run it because SCRIPT_AfterVSS (%s,%i,%i,%c)\n", 
+                  script->command, script->on_success, script->on_failure,
+                  jcr->JobStatus );
+            runit = true;
+         }
+      }
+
       if ((script->when & SCRIPT_After) && (when & SCRIPT_After)) {
          if ((script->on_success && (jcr->JobStatus == JS_Terminated))
              || (script->on_failure && job_canceled(jcr))
@@ -176,7 +190,7 @@ bool RUNSCRIPT::is_local()
 }
 
 /* set this->command to cmd */
-void RUNSCRIPT::set_command(const POOLMEM *cmd, int acmd_type)
+void RUNSCRIPT::set_command(const char *cmd, int acmd_type)
 {
    Dmsg1(500, "runscript: setting command = %s\n", NPRT(cmd));
 
@@ -193,7 +207,7 @@ void RUNSCRIPT::set_command(const POOLMEM *cmd, int acmd_type)
 }
 
 /* set this->target to client_name */
-void RUNSCRIPT::set_target(const POOLMEM *client_name)
+void RUNSCRIPT::set_target(const char *client_name)
 {
    Dmsg1(500, "runscript: setting target = %s\n", NPRT(client_name));