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
16 Index: src/lib/runscript.c
17 ===================================================================
18 --- src/lib/runscript.c (révision 5993)
19 +++ src/lib/runscript.c (copie de travail)
22 if (strstr(label, NT_("Before"))) {
24 + } else if (bstrcmp(label, NT_("ClientRunAfterVSS"))) {
25 + when = SCRIPT_AfterVSS;
33 + if ((script->when & SCRIPT_AfterVSS) && (when & SCRIPT_AfterVSS)) {
34 + if ((script->on_success
35 + && (jcr->JobStatus == JS_Running || jcr->JobStatus == JS_Created))
36 + || (script->on_failure && job_canceled(jcr))
39 + Dmsg4(200, "runscript: Run it because SCRIPT_AfterVSS (%s,%i,%i,%c)\n",
40 + script->command, script->on_success, script->on_failure,
46 if ((script->when & SCRIPT_After) && (when & SCRIPT_After)) {
47 if ((script->on_success && (jcr->JobStatus == JS_Terminated))
48 || (script->on_failure && job_canceled(jcr))
49 Index: src/lib/runscript.h
50 ===================================================================
51 --- src/lib/runscript.h (révision 5993)
52 +++ src/lib/runscript.h (copie de travail)
55 SCRIPT_After = (1<<0), /* AfterJob */
56 SCRIPT_Before = (1<<1), /* BeforeJob */
57 + SCRIPT_AfterVSS = (1<<2), /* BeforeJob and After VSS */
58 SCRIPT_Any = SCRIPT_Before | SCRIPT_After
61 Index: src/filed/job.c
62 ===================================================================
63 --- src/filed/job.c (révision 5993)
64 +++ src/filed/job.c (copie de travail)
67 Jmsg(jcr, M_WARNING, 0, _("VSS was not initialized properly. VSS support is disabled. ERR=%s\n"), be.bstrerror());
69 + run_scripts(jcr, jcr->RunScripts, "ClientAfterVSS");
73 Index: src/dird/dird_conf.c
74 ===================================================================
75 --- src/dird/dird_conf.c (révision 5993)
76 +++ src/dird/dird_conf.c (copie de travail)
77 @@ -1682,10 +1682,12 @@
78 *(int *)(item->value) = SCRIPT_Before ;
79 } else if (strcasecmp(lc->str, "after") == 0) {
80 *(int *)(item->value) = SCRIPT_After;
81 + } else if (strcasecmp(lc->str, "aftervss") == 0) {
82 + *(int *)(item->value) = SCRIPT_AfterVSS;
83 } else if (strcasecmp(lc->str, "always") == 0) {
84 *(int *)(item->value) = SCRIPT_Any;
86 - scan_err2(lc, _("Expect %s, got: %s"), "Before, After or Always", lc->str);
87 + scan_err2(lc, _("Expect %s, got: %s"), "Before, After, AfterVSS or Always", lc->str);