Table of Contents |
---|
Introduction
This documentation describes how the substitution of parameter values works in JobScheduler. It is also described how to use paramters in shell script, API Jobs and pre- and postprocessing scripts.
Substitution of parameter values done by JobScheduler
JobScheduler substitutes the values of environment variables when using ${<env_var>}
in task parameters.
When <env_var>
is an unknown environment variable, JobScheduler substitutes it to empty
To avoid doing the substitution by JobScheduler the value can be quoted with a backslash like \${<env_var>}
Example
Code Block | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
<job name="job_environment">
<params >
<param name="param_from_environment" value="the value of scheduler_home is ${SCHEDULER_HOME} ${test}"/>
</params>
<script language="shell">
<![CDATA[
echo %SCHEDULER_PARAM_PARAM_FROM_ENVIRONMENT%
]]>
</script>
<monitor name="process0" ordering="0">
<script language="java:javascript">
<![CDATA[
function spooler_process_before(){
spooler_log.info("param_from_environment=" + spooler_task.params.var("param_from_environment"));
return true;
}
]]>
</script>
</monitor>
<run_time />
</job>
|
When running this job the output will b:
Code Block | ||||
---|---|---|---|---|
| ||||
2015-12-07 10:39:32.458+0100 [info] SCHEDULER-918 state=starting (at=2015-12-07 10:39:32.403+0100)
2015-12-07 10:39:33.984+0100 [info] param_from_environment=the value of scheduler_home is C:/Program Files/sos-berlin.com/jobscheduler/scheduler_current
2015-12-07 10:39:33.987+0100 [info] SCHEDULER-987 Starting process: "C:\WINDOWS\TEMP\\sos-A4CFC1B980.cmd"
2015-12-07 10:39:34.019+0100 [info] [stdout]
2015-12-07 10:39:34.019+0100 [info] [stdout] C:\Users\ur\Documents\sos-berlin.com\jobscheduler\scheduler_current>echo the value of scheduler_home is C:/Program Files/sos-berlin.com/jobscheduler/scheduler_current
2015-12-07 10:39:34.019+0100 [info] [stdout] the value of scheduler_home is C:/Program Files/sos-berlin.com/jobscheduler/scheduler_current
|
Please note
${test}
has been substituted toempty
- To access the value of the parameter in a shell script, the name must be prefixed. The value of the prefix is
- Default: SCHEDULER_PARAM_
- Can be set by the parameter scheduler.variable_name_prefix which is defined in the file $scheduler_data/config/scheduler.xml
- When changing the value of the prefix, JobScheduler has to be restartet.
- Can be set by the parameter scheduler.variable_name_prefix which is defined in the file $scheduler_data/config/scheduler.xml
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
<?xml-stylesheet type="text/xsl" href="scheduler_documentation.xsl" ?>
<spooler>
<config mail_xslt_stylesheet="config/scheduler_mail.xsl" port="4102">
<params>
<param name="scheduler.variable_name_prefix" value="SCHEDULER_PARAM_"/>
<param name="scheduler.order.keep_order_content_on_reschedule" value="false"/>
</params> |
Attention: JobScheduler do NOT substitute environment variables in order parameters.