Assuming, you have a shell script as a member of a job chain. You want to check, wether the call of the script is after a suspend, that means, the last call ended with an error.
You can achive this by adding a pre/postprocessing to the job.
Setting the default value of an order parameter "suspend" in the preprocessing
function spooler_process_before()\{ var order = spooler_task.order; if (order.params.value("suspend") == null)\{ order.params.set_var("suspend","false"); \} return true; \}
Checking Exit-Code. If not zero set order parameter "suspend" to true
function spooler_process_before()\{ var order = spooler_task.order; if (order.params.value("suspend") == null)\{ order.params.set_var("suspend","false"); \} return true; \}
Then you have the environment variable accessible in your script
echo ------ %scheduler_param_suspend%
The whole sample can be downloaded here suspend_sample.zip