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}
  • 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.

List of generally available Environment Variables

Environment Variable ExampleDescription
SCHEDULER_IDSCHEDULER-1-10-2identification of JobScheduler instances as specified during installation
SCHEDULER_JOB_NAMEsample_jobjob name
SCHEDULER_JOB_CHAINsample_job_chainjob chain name
SCHEDULER_PARAM_...
parameters are povided with their name and the prefix SCHEDULER_PARAM_ 1)
JS-1517 - Getting issue details... STATUS  
SCHEDULER_PARAM_SCHEDULER_FILE_PATHC:\Windows\INCOMGING_FILES\test.pdfpath 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.pdfsemicolon-separated list of files that cause a job to be started, see Directory Monitoring
SCHEDULER_TASK_ID4711unique numerical identifier of every task run by a JobScheduler
SCHEDULER_ORDER_IDend_of_day_processingorder identification
SCHEDULER_ORDER_HISTORY_ID123456789
unique numerical identifier for an order run
JS-1513 - Getting issue details... STATUS  
SCHEDULER_RETURN_VALUESC:\Windows\TEMP\sosDF2C.tmplocation of temporay file that stores return values (name=value) for successor jobs
SCHEDULER_JOB_CONFIGURATION_DIRECTORYC:/ProgramData/sos-berlin.com/jobscheduler/scheduler/config/live/exampleslocation of current folder with job objects
SCHEDULER_CONFIGURATION_DIRECTORYC:/ProgramData/sos-berlin.com/jobscheduler/scheduler/config/live location of live folder
SCHEDULER_DATAC:/ProgramData/sos-berlin.com/jobscheduler/scheduler/scheduler_datalocation of data directory
SCHEDULER_HOMEC:/ProgramData/sos-berlin.com/jobscheduler/scheduler location of installation directory
SCHEDULER_HOSTlocalhosthost with JobScheduler installation
SCHEDULER_TCP_PORT4444TCP port that JobScheduler listens to
SCHEDULER_UDP_PORT4444UDP port that JobScheduler listens to
SCHEDULER_SUPERVISOR_HOSTlocalhostHostname of a Supervisor JobScheduler if configured as <config supervisor="..." > in ./config/scheduler.xml
SCHEDULER_SUPERVISOR_PORT4444TCP port of a Supervisor JobScheduler if configured as <config supervisor="..." > in ./config/scheduler.xml

List of job specific Environment Variables 

Environment Variable JobDescription
SCHEDULER_SOSFILEOPERATIONS_RESULTSETYADE JITL JobA colon separated list of file names for the files that have been transferred

List of Environment Variables available with Agents

Environment Variable ExampleDescription
SCHEDULER_ORDER_STATEstartstate of the node that the crder currently passes
SCHEDULER_TASKSTART_DATE01.12.2017 09:13:59+0100Date in country format as specified by LANG environment variable
SCHEDULER_TASKSTART_DATE_ISO2017-12-01T09:13:59+0100Date in ISO format
SCHEDULER_TASKSTART_DAY31Day of task start time
SCHEDULER_TASKSTART_MONTH12Month of task start time
SCHEDULER_TASKSTART_YEAR2017Year of task start time
SCHEDULER_TASKSTART_HOUR23Hour of task start time
SCHEDULER_TASKSTART_MINUTE59Minute of task start time
SCHEDULER_TASKSTART_SECOND32Second of task start time

List of Environment Variables available with Job Streams

Environment Variable ExampleDescription
SCHEDULER_JOBSTREAM_INSTANCE_IDc3f88b94-fd4e-4365-9593-0cf34d575f6eThe instance id of the actual running job stream
SCHEDULER_JOBSTREAM_JOBSTREAMmyStreamThe name of the job stream
SCHEDULER_JOBSTREAM_TIME2017-12-01 09:13:59The actual time in the format HH:mm:ss
SCHEDULER_JOBSTREAM_CENTURY31Day of task start time dd
SCHEDULER_JOBSTREAM_DAY2012Year of task start time YYYY
SCHEDULER_JOBSTREAM_YEAR2017Year of task start time YYYY
SCHEDULER_JOBSTREAM_YEAR_YY21Year of task start time YY
SCHEDULER_JOBSTREAM_MONTH12Month of task start time mm
SCHEDULER_JOBSTREAM_MONTH_NAMEAprilMonth name of task start time display name UK
SCHEDULER_JOBSTREAM_DATE20171201Date of task start time yyyyMMdd
SCHEDULER_JOBSTREAM_DATE_YY17-12-01Dateof task start time yyMMdd
SCHEDULER_JOBSTREAM_DATE_YYYY2017-12-01Dateof task start time yyyyMMdd
SCHEDULER_JOBSTREAM_FOLDER/jobsThe folder for the actual running job
SCHEDULER_JOBSTREAM_JOBNAMEjobs/myJobThe name of the job

Explanations

  1. For job parameters the default setting is to be prefixed with SCHEDULER_PARAM_, e.g. the parameter hostname will become SCHEDULER_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 variable HOSTNAME.

    • 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 variable MY_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 variable SCHEDULER_PARAM_HOSTNAME.


  • No labels