...
- Job parameters and order parameters are accessible by environment variables to shell jobs.
- There is a simple rule for the naming of environment variables:
- the The name of the environment variable for a parameter is SCHEDULER_PARAM_NAMEOFPARAM.
- for For example the job parameter param1 is available by the environment variable SCHEDULER_PARAM_PARAM1
- environment Environment variables are used with uppercase letters
...
If you wanted not to use the prefix SCHEDULER_PARAM_ and instead use the parameter names as environment variables then you could add the following setting to your ./config/scheduler.xml file:
Code Block language xml <params> <param name="scheduler.variable_name_prefix" value="*NONE"/> ... </param>
Hint: You have been warned, JobScheduler would overwrite existing environment variables with the same name for the respective shell.
Examples
Code Block | ||||
---|---|---|---|---|
| ||||
<job> <params> <param name="param1" value="Test"/> </params> <script language="shell"> <![CDATA[ rem This is an example shell script to show the use of parameters echo Param1 has the value %SCHEDULER_PARAM_PARAM1% ]]> </script> <run_time/> </job> |
Code Block | ||||
---|---|---|---|---|
| ||||
<job> <params> <param name="param1" value="Test"/> </params> <script language="shell"> <![CDATA[ # This is an example shell script to show the use of parameters echo "Param1 has the value $SCHEDULER_PARAM_PARAM1" ]]> </script> <run_time/> </job |
If you want to use the parameters as command line arguments for a script in the command line then just add the environment variables when calling the scriptas arguments in the command line:
Code Block | ||||
---|---|---|---|---|
| ||||
anyshellscript.sh $SCHEDULER_PARAM_PARAM1 $SCHEDULER_PARAM_PARM2 ... |
...