You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 6 Next »

 

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 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 the Exit-Code. If not zero set the order parameter "suspend" to true

 function spooler_task_after(){
    var order = spooler_task.order;
    if (spooler_task.exit_code == 0){
       order.params.set_var("suspend","false");
    }else{
       order.params.set_var("suspend","true");
    }
    return true;
 }

Then the environment variable will be accessible in your script

 echo ------ %scheduler_param_suspend%

The whole sample can be downloaded here suspend_sample.zip

  • No labels