Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

 

...

Assuming, you have a shell script as a member of a job chain. You want to check, whether the call of the script is running after a suspend, that is, the last call ended with an error.

You can achive achieve this by adding a pre/postprocessing some pre-processing and post-processing to the job.

Setting the default value of an order parameter "suspend" in the preprocessingpre-processing

Code Block

 function spooler_process_before()\ {
    var order = spooler_task.order;  
    if (order.params.value("suspend") == null)\{
       order.params.set_var("suspend","false");
    \}
   
    return true;
  \}

Checking the Exit-Codeexit code. If not zero then set the order parameter "suspend" to true

Code Block
languagejs

 function spooler_processtask_beforeafter()\{
    var order = spooler_task.order;
    if (spooler_task.exit_code == 0){
       order.params.valueset_var("suspend","false");
 == null)\   }else{
       order.params.set_var("suspend","falsetrue");
    \}	
    return true;
  \}

Then the environment variable will be accessible in your script:

Code Block

 echo ------ %scheduler_param_suspend%

The whole sample can be downloaded here suspend_sample.zip