run_scripts(jcr, jcr->RunScripts, "ClientBeforeJob");
if (job_canceled(jcr)) {
- return bnet_fsend(dir, _("2905 Bad RunBeforeNow command.\n"));
+ bnet_fsend(dir, _("2905 Bad RunBeforeNow command.\n"));
+ Dmsg0(100, "Back from run_scripts ClientBeforeJob now: FAILED\n");
+ return 0;
} else {
- return bnet_fsend(dir, OKRunBeforeNow);
+ bnet_fsend(dir, OKRunBeforeNow);
+ Dmsg0(100, "Back from run_scripts ClientBeforeJob now: OK\n");
+ return 1;
}
}
* For a set of errors, ... keep the current status
* so it isn't lost. For all others, set it.
*/
+ Dmsg2(100, "OnEntry JobStatus=%c set=%c\n", jcr->JobStatus, JobStatus);
switch (jcr->JobStatus) {
case JS_ErrorTerminated:
- case JS_Error:
case JS_FatalError:
- case JS_Differences:
case JS_Canceled:
break;
+ case JS_Error:
+ case JS_Differences:
+ switch (JobStatus) {
+ case JS_ErrorTerminated:
+ case JS_FatalError:
+ case JS_Canceled:
+ /* Override more minor status */
+ jcr->JobStatus = JobStatus;
+ break;
+ default:
+ break;
+ }
default:
jcr->JobStatus = JobStatus;
}
+ Dmsg2(100, "OnExit JobStatus=%c set=%c\n", jcr->JobStatus, JobStatus);
}
#ifdef TRACE_JCR_CHAIN
be.code(status), be.bstrerror(status));
goto bail_out;
}
+ Dmsg0(100, "runscript OK\n");
return true;
bail_out:
- /* cancel running job properly */
- if (fail_on_error) {
- set_jcr_job_status(jcr, JS_ErrorTerminated);
- }
- return false;
+ /* cancel running job properly */
+ if (fail_on_error) {
+ set_jcr_job_status(jcr, JS_ErrorTerminated);
+ }
+ Dmsg1(100, "runscript failed. fail_on_error=%d\n", fail_on_error);
+ return false;
}
void free_runscripts(alist *runscripts)
General:
22Jul07
+kes Correct RunScript to terminate job in FD on failure.
kes Change abort_on_error and AbortJobOnError to fail_on_error
and FailJobOnError in RunScripts.
kes Minor tweaks of code formating in RunScripts, principally to