1 Add a new runswhen directive ClientRunAfterVSS
2 "Run After VSS snapshot, but before backup"
4 It can be applied to Bacula trunk (and probably earlier
8 ./configure <your options>
9 patch -p0 <clientrunaftervss.patch
14 Index: src/dird/dird_conf.c
15 ===================================================================
16 --- src/dird/dird_conf.c (révision 6325)
17 +++ src/dird/dird_conf.c (copie de travail)
18 @@ -1688,10 +1688,12 @@
19 *(int *)(item->value) = SCRIPT_Before ;
20 } else if (strcasecmp(lc->str, "after") == 0) {
21 *(int *)(item->value) = SCRIPT_After;
22 + } else if (strcasecmp(lc->str, "aftervss") == 0) {
23 + *(int *)(item->value) = SCRIPT_AfterVSS;
24 } else if (strcasecmp(lc->str, "always") == 0) {
25 *(int *)(item->value) = SCRIPT_Any;
27 - scan_err2(lc, _("Expect %s, got: %s"), "Before, After or Always", lc->str);
28 + scan_err2(lc, _("Expect %s, got: %s"), "Before, After, AfterVSS or Always", lc->str);
32 Index: src/filed/job.c
33 ===================================================================
34 --- src/filed/job.c (révision 6325)
35 +++ src/filed/job.c (copie de travail)
38 Jmsg(jcr, M_WARNING, 0, _("VSS was not initialized properly. VSS support is disabled. ERR=%s\n"), be.bstrerror());
40 + run_scripts(jcr, jcr->RunScripts, "ClientAfterVSS");
44 Index: src/lib/runscript.h
45 ===================================================================
46 --- src/lib/runscript.h (révision 6325)
47 +++ src/lib/runscript.h (copie de travail)
50 SCRIPT_After = (1<<0), /* AfterJob */
51 SCRIPT_Before = (1<<1), /* BeforeJob */
52 + SCRIPT_AfterVSS = (1<<2), /* BeforeJob and After VSS */
53 SCRIPT_Any = SCRIPT_Before | SCRIPT_After
56 Index: src/lib/runscript.c
57 ===================================================================
58 --- src/lib/runscript.c (révision 6325)
59 +++ src/lib/runscript.c (copie de travail)
62 if (strstr(label, NT_("Before"))) {
64 + } else if (bstrcmp(label, NT_("ClientAfterVSS"))) {
65 + when = SCRIPT_AfterVSS;
73 + if ((script->when & SCRIPT_AfterVSS) && (when & SCRIPT_AfterVSS)) {
74 + if ((script->on_success && (jcr->JobStatus == JS_Blocked))
75 + || (script->on_failure && job_canceled(jcr))
78 + Dmsg4(200, "runscript: Run it because SCRIPT_AfterVSS (%s,%i,%i,%c)\n",
79 + script->command, script->on_success, script->on_failure,
85 if ((script->when & SCRIPT_After) && (when & SCRIPT_After)) {
86 if ((script->on_success && (jcr->JobStatus == JS_Terminated))
87 || (script->on_failure && job_canceled(jcr))