Use of Environment Variables
- JobScheduler provides a number of environment variables that are available to the job tasks environment
- These environment variables are valid on the host where JobScheduler Master and Agent are executed.
- Use of the environment variable syntax depends on the operating system:
- For Windows use
%SCHEDULER_JOB_NAME%
- For Unix use
$SCHEDULER_JOB_NAME
or${SCHEDULER_JOB_NAME}
- For Windows use
- Mixed spelling with uppercase and lowercase letters is handled differently depending on the operating system:
- For Windows any mixed spelling can be used, i.e.
%SCHEDULER_JOB_NAME%, %Scheduler_Job_Name%, %SCHEDULER_job_name%
will address the same environment variable. - For Unix the exact spelling has to be used, i.e.
$SCHEDULER_JOB_NAME, $Scheduler_Job_Name, $SCHEDULER_job_name
represent different environment variables, only the first one is valid.
- For Windows any mixed spelling can be used, i.e.
List of generally available Environment Variables
Environment Variable | Example | Description |
---|---|---|
SCHEDULER_ID | SCHEDULER-1-10-2 | identification of JobScheduler instances as specified during installation |
SCHEDULER_JOB_NAME | sample_job | job name |
SCHEDULER_JOB_CHAIN | sample_job_chain | job chain name |
SCHEDULER_PARAM_... | ||
SCHEDULER_PARAM_SCHEDULER_FILE_PATH | C:\Windows\INCOMGING_FILES\test.pdf | path of the file that causes a job chain to start by <file_order_source> ; variable is prefixed with SCHEDULER_PARAM_ 1) , see File Watching |
SCHEDULER_TASK_TRIGGER_FILES | C:\Windows\INCOMGING_FILES\test1.pdf;C:\Windows\INCOMGING_FILES\test2.pdf | semicolon-separated list of files that cause a job to be started, see Directory Monitoring |
SCHEDULER_TASK_ID | 4711 | unique numerical identifier of every task run by a JobScheduler |
SCHEDULER_ORDER_ID | end_of_day_processing | order identification |
SCHEDULER_ORDER_HISTORY_ID | 123456789 | |
SCHEDULER_RETURN_VALUES | C:\Windows\TEMP\sosDF2C.tmp | location of temporay file that stores return values (name=value ) for successor jobs |
SCHEDULER_JOB_CONFIGURATION_DIRECTORY | C:/ProgramData/sos-berlin.com/jobscheduler/scheduler/config/live/examples | location of current folder with job objects |
SCHEDULER_CONFIGURATION_DIRECTORY | C:/ProgramData/sos-berlin.com/jobscheduler/scheduler/config/live | location of live folder |
SCHEDULER_DATA | C:/ProgramData/sos-berlin.com/jobscheduler/scheduler/scheduler_data | location of data directory |
SCHEDULER_HOME | C:/ProgramData/sos-berlin.com/jobscheduler/scheduler | location of installation directory |
SCHEDULER_HOST | localhost | host with JobScheduler installation |
SCHEDULER_TCP_PORT | 4444 | TCP port that JobScheduler listens to |
SCHEDULER_UDP_PORT | 4444 | UDP port that JobScheduler listens to |
SCHEDULER_SUPERVISOR_HOST | localhost | Hostname of a Supervisor JobScheduler if configured as <config supervisor="..." > in ./config/scheduler.xml |
SCHEDULER_SUPERVISOR_PORT | 4444 | TCP port of a Supervisor JobScheduler if configured as <config supervisor="..." > in ./config/scheduler.xml |
List of job specific Environment Variables
Environment Variable | Job | Description |
---|---|---|
SCHEDULER_SOSFILEOPERATIONS_RESULTSET | YADE JITL Job | A colon separated list of file names for the files that have been transferred |
List of Environment Variables available with Agents
Environment Variable | Example | Description |
---|---|---|
SCHEDULER_ORDER_STATE | start | state of the node that the crder currently passes |
SCHEDULER_TASKSTART_DATE | 01.12.2017 09:13:59+0100 | Date in country format as specified by LANG environment variable |
SCHEDULER_TASKSTART_DATE_ISO | 2017-12-01T09:13:59+0100 | Date in ISO format |
SCHEDULER_TASKSTART_DAY | 31 | Day of task start time |
SCHEDULER_TASKSTART_MONTH | 12 | Month of task start time |
SCHEDULER_TASKSTART_YEAR | 2017 | Year of task start time |
SCHEDULER_TASKSTART_HOUR | 23 | Hour of task start time |
SCHEDULER_TASKSTART_MINUTE | 59 | Minute of task start time |
SCHEDULER_TASKSTART_SECOND | 32 | Second of task start time |
List of Environment Variables available with Job Streams
Environment Variable | Example | Description |
---|---|---|
SCHEDULER_JOBSTREAM_INSTANCE_ID | c3f88b94-fd4e-4365-9593-0cf34d575f6e | The instance id of the actual running job stream |
SCHEDULER_JOBSTREAM_JOBSTREAM | myStream | The name of the job stream |
SCHEDULER_JOBSTREAM_TIME | 2017-12-01 09:13:59 | The actual time in the format HH:mm:ss |
SCHEDULER_JOBSTREAM_CENTURY | 31 | Day of task start time dd |
SCHEDULER_JOBSTREAM_DAY | 2012 | Year of task start time YYYY |
SCHEDULER_JOBSTREAM_YEAR | 2017 | Year of task start time YYYY |
SCHEDULER_JOBSTREAM_YEAR_YY | 21 | Year of task start time YY |
SCHEDULER_JOBSTREAM_MONTH | 12 | Month of task start time mm |
SCHEDULER_JOBSTREAM_MONTH_NAME | April | Month name of task start time display name UK |
SCHEDULER_JOBSTREAM_DATE | 20171201 | Date of task start time yyyyMMdd |
SCHEDULER_JOBSTREAM_DATE_YY | 17-12-01 | Dateof task start time yyMMdd |
SCHEDULER_JOBSTREAM_DATE_YYYY | 2017-12-01 | Dateof task start time yyyyMMdd |
SCHEDULER_JOBSTREAM_FOLDER | /jobs | The folder for the actual running job |
SCHEDULER_JOBSTREAM_JOBNAME | jobs/myJob | The name of the job |
Explanations
- For job parameters the default setting is to be prefixed with
SCHEDULER_PARAM_
, e.g. the parameterhostname
will becomeSCHEDULER_PARAM_HOSTNAME
.You can modify this behavior by specifying job parameters to be used without any prefix. This can be achieved by adding the following parameter configuration to your
./config/scheduler.xml
file and by restarting JobScheduler:<params> <param name="scheduler.variable_name_prefix" value="*NONE"/> </params>
With this setting a parameter
hostname
will be provided with the environment variableHOSTNAME.
You can use an arbitrary prefix by specifying:
<params> <param name="scheduler.variable_name_prefix" value="MY_SCHEDULER_PARAM_"/> </params>
With this setting a parameter
hostname
will be provided with the environment variableMY_SCHEDULER_PARAM_HOSTNAME.
The default value is provided by the implicit setting:
<params> <param name="scheduler.variable_name_prefix" value="SCHEDULER_PARAM_"/> </params>
With this setting a parameter
hostname
will be provided with the environment variableSCHEDULER_PARAM_HOSTNAME.