/*
Bacula® - The Network Backup Solution
- Copyright (C) 2006-2007 Free Software Foundation Europe e.V.
+ Copyright (C) 2006-2011 Free Software Foundation Europe e.V.
The main author of Bacula is Kern Sibbald, with contributions from
many others, a complete list can be found in the file AUTHORS.
This program is Free Software; you can redistribute it and/or
- modify it under the terms of version two of the GNU General Public
+ modify it under the terms of version three of the GNU Affero General Public
License as published by the Free Software Foundation and included
in the file LICENSE.
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License
+ You should have received a copy of the GNU Affero General Public License
along with this program; if not, write to the Free Software
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.
*
* Eric Bollengier, May 2006
*
- * Version $Id$
- *
*/
if (strstr(label, NT_("Before"))) {
when = SCRIPT_Before;
+ } else if (bstrcmp(label, NT_("ClientAfterVSS"))) {
+ when = SCRIPT_AfterVSS;
} else {
when = SCRIPT_After;
}
runit = false;
if ((script->when & SCRIPT_Before) && (when & SCRIPT_Before)) {
- if ((script->on_success
- && (jcr->JobStatus == JS_Running || jcr->JobStatus == JS_Created))
- || (script->on_failure && job_canceled(jcr))
+ if ((script->on_success &&
+ (jcr->JobStatus == JS_Running || jcr->JobStatus == JS_Created))
+ || (script->on_failure &&
+ (job_canceled(jcr) || jcr->JobStatus == JS_Differences))
)
{
Dmsg4(200, "runscript: Run it because SCRIPT_Before (%s,%i,%i,%c)\n",
}
}
+ 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))
+ if ((script->on_success &&
+ (jcr->JobStatus == JS_Terminated || jcr->JobStatus == JS_Warnings))
+ || (script->on_failure &&
+ (job_canceled(jcr) || jcr->JobStatus == JS_Differences))
)
{
Dmsg4(200, "runscript: Run it because SCRIPT_After (%s,%i,%i,%c)\n",
}
/* 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));
}
/* 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));
bail_out:
/* cancel running job properly */
if (fail_on_error) {
- set_jcr_job_status(jcr, JS_ErrorTerminated);
+ jcr->setJobStatus(JS_ErrorTerminated);
}
Dmsg1(100, "runscript failed. fail_on_error=%d\n", fail_on_error);
return false;