Introduction
- Environment variables are a means to parameterize jobs.
- Environment variables allow read and write operations, however, modifying the value of an environment variable works within the scope of the current job only.
- Environment Variables are used with uppercase letters only. For Windows environments the uppercase/lowercase spelling makes no difference, however, for Unix different spellings create different environment variables.
- A number of environment variables are available to shell jobs by default.
- Additional environment variables can be added per job configuration from JS7 - Order Variables, from node arguments and from JS7 - Job Resources.
Environment Variables that are automatically available to Shell Jobs
The following environment variables are available to all shell jobs. They are provided from the Agent Instance Script and from the Agent binary files.
Depending on the OS, environment variables are syntactically used like this:
- Windows:
%JS_AGENT_HOME%
- Unix:
$JS_AGENT_HOME
or${JS_AGENT_HOME}
Category | Environment Variable | Description | Adjustable by Script | Default Value |
---|---|---|---|---|
Agent | JS7_AGENT_PORT | The number of the port that an Agent is listening to for messages sent from a Controller. | Agent Instance Script | 4445 |
JS7_AGENT_HTTP_PORT | Same as JS7_AGENT_PORT except that a network interface can be specified, e.g. localhost:4445 to limit access to the given network interface. This environment variable will not be available if the Agent is configured not to listen to an HTTP port. | Agent Instance Script | 4445 | |
JS7_AGENT_HTTPS_PORT | The SSL port used in addition to the HTTP port. A network interface can be specified, e.g. myhost:4447 to limit access to the given network interface. This environment variable will not be available if the Agent is not configured to listen to an HTTPS port. | Agent Instance Script | n/a | |
JS7_AGENT_USER | The account that the Agent is operated for. For Unix OS the account can be specified from the Agent Instance Script. For Windows OS the service account assigned to the Agent with the Windows Service Panel is provided. | Unix: Agent Instance Script Windows: Service Account | n/a | |
| The Agent's home directory, i.e. the directory in which the Agent has been installed. For Windows OS this could be e.g. For Unix OS environments this could be e.g. | Agent Instance Script | n/a | |
JS7_AGENT_DATA | The Agent's data directory with sub-directories for temporary data, configuration data etc. The name of the data directory is created from the prefix For Windows OS this could be e.g. For Unix OS environments this could be e.g. The Agent's home directory | Agent Instance Script | JS7_AGENT_HOME/var_<JS7_AGENT_HTTP_PORT> | |
JS7_AGENT_CONFIG_DIR | The Agent's configuration directory. | Agent Instance Script | JS7_AGENT_DATA/config | |
JS7_AGENT_LOGS | The Agent's directory for log files. | Agent Instance Script | JS7_AGENT_DATA/logs | |
JS7_AGENT_PID_FILE | The Agent's creates the agent.pid file in the logs directory that contains the process ID of the current Agent being run. | Agent Instance Script | JS7_AGENT_DATA/logs/agent.pid | |
JS7_AGENT_WORK_DIR | The Agent's working directory. | Agent Instance Script | JS7_AGENT_DATA | |
JS7_AGENT_TZ | The time zone of the Agents' computer | Agent Start Script | Etc/UTC | |
Run-time | JS7_RETURN_VALUES | The location of a temporary file created by the Agent for the current shell job. This can be used to append pairs of names and values with each pair being added on a separate line. After execution of the shell job the Agent will add order variables with the respective names and values found from this file. | n/a | |
JAVA_HOME | The location of the Java installation directory as used by the Agent. | Agent Instance Script | JAVA_HOME | |
JAVA_OPTIONS | Java options for the Agent loading its JVM are different from Java options used for jobs that run individual Java programs. Therefore the Agent Start Script allows the JS7_AGENT_JOB_JAVA_OPTIONS environment variable to be set, e.g. to limit a job's memory consumption with the option -Xmx32m . Therefore this environment variable is populated from the Java job options environment variable. | Agent Instance Script | JS7_AGENT_JOB_JAVA_OPTIONS | |
File Transfer | JS7_YADE_HOME | The home directory of the YADE installation. By default the Agent ships with YADE included in the yade sub-directory of the Agent's home directory. | n/a | JS7_AGENT_HOME/yade |
JS7_YADE_BIN | The path to the YADE start script. Usually this is located in the bin sub-directory of the directory specified by JS7_YADE_HOME . | n/a | Unix: Windows: | |
JS7_YADE_DMZ_BIN | The location of the start script used to run YADE in a DMZ. By default the directory is the same as JS7_YADE_HOME/bin and the file name is yade4dmz.sh . | n/a | Unix: Windows: | |
JS7_YADE_CONFIG_DIR | The location of the configuration directory that holds YADE file transfer configuration files (*.xml, *.ini). By default the Agent's configuration directory is used. | Agent Instance Script | JS7_AGENT_CONFIG_DIR |
Environment Variables from Job Resources for Shell Jobs
The environment variables listed in this section are not available by default.
- They are provided from default Job Resources that are available for download and that can be assigned to any workflows and jobs.
- You can find the archive
Defaults.zip
for download here: JS7 - Download. - The .zip archive includes the following Job Resources:
Default.jobresource.json
eMailDefault.jobresource.json
- After import the Job Resources are available in the JOC Cockpit Configuration view, in the
/Defaults
folder and with the namesDefault
andeMailDefault
.
- You can find the archive
- They can be provided from individual JS7 - Job Resources.
Users are free to define their own job resources to publish individual environment variables to workflows and jobs.
Job Resource: Default
Category | Environment Variable | Description | Default Value |
---|---|---|---|
Controller | JS7_CONTROLLER_ID | Identification of a Controller as specified during initial operation. | n/a |
Inventory | JS7_JOB_NAME | The name of the job as specified with the workflow configuration. | |
JS7_ORDER_ID | The order identification as returned when creating an order. | ||
JS7_WORKFLOW_NAME | The name of the workflow. | ||
JS7_WORKFLOW_LABEL | The label assigned the workflow instruction for the job. Consider that the same job can be used a number of times in a workflow and that its assignment to an instruction is additionally specified by a label. | ||
JS7_WORKFLOW_POSITION | The indicator for the position of the order in the current workflow. | ||
Run-time | JS7_JOB_EXECUTION_COUNT | A numeric indicator for the number of times a job is executed for a particular order. With the first execution of a job the value will start with 1 and will be incremented, for example, if a job is repeated due to a Retry Instruction or if an order is resumed by user intervention repeating the job in the workflow. The value is incremented for each execution of a job independently of the fact that this job might occur a number of times in different nodes of a workflow. | |
Scheduled Date | JS7_SCHEDULED_DATE | The date for which an order was originally scheduled. The date format includes yyyy, MM, dd, HH, mm, ss and the time zone offset, e.g. 2020-12-03 09:13:59+0100 | Scheduled Date |
JS7_SCHEDULED_YEAR | The year of the scheduled date padded to 4 digits, e.g. 2020, 2021, 2022 etc. | Year of Scheduled Date | |
JS7_SCHEDULED_MONTH | The month of the scheduled date padded to 2 digits, e.g. 01, ..., 12 | Month of Scheduled Date | |
JS7_SCHEDULED_DAY | The day of the scheduled date padded to 2 digits, e.g. 01, ..., 31 | Day of Scheduled Date | |
JS7_SCHEDULED_HOUR | The hour of the scheduled date padded to 2 digits, e.g. 00, ..., 24 | Hour of Scheduled Date | |
JS7_SCHEDULED_MINUTE | The minute of the scheduled date padded to 2 digits, e.g. 01, ..., 59 | Minute of Scheduled Date | |
JS7_SCHEDULED_SECOND | The second of the scheduled date padded to 2 digits, e.g. 01, ..., 59 | Second of Scheduled Date | |
Job Start Date | JS7_JOBSTART_DATE | The date at which the job was started. The date format includes yyyy, MM, dd, HH, mm, ss and the time zone offset, e.g. 2020-12-03 09:13:59+0100 | Start Date of the task for a shell job or Start Date of the processing of an order by a JVM job |
JS7_JOBSTART_YEAR | The year of the job start date padded to 2 digits, e.g. 2020, 2021, 2022 etc. | Year of Job Start Date | |
JS7_JOBSTART_MONTH | The month of the job start date padded to 2 digits, e.g. 01, ..., 12 | Month of Job Start Date | |
JS7_JOBSTART_DAY | The day of the job start date padded to 2 digits, e.g. 01, ..., 31 | Day of Job Start Date | |
JS7_JOBSTART_HOUR | The hour of the job start date padded to 2 digits, e.g. 00, ..., 24 | Hour of Job Start Date | |
JS7_JOBSTART_MINUTE | The minute of the job start date padded to 2 digits, e.g. 01, ..., 59 | Minute of Job Start Date | |
JS7_JOBSTART_SECOND | The second of the job start date padded to 2 digits, e.g. 01, ..., 59 | Second of Job Start Date | |
JS7_JOBSTART_EPOCHMILLI | The number of milliseconds since January 1st 1970 UTC until the job start date | Epoch milliseconds for Job Start Date |
Explanation:
- Note that the Scheduled Date is available only for orders that have been scheduled for a start time.
- This applies to scheduled orders created by JS7 - Schedules.
- This also applies to Ad Hoc orders created from the JS7 - Workflows that are assigned a start time
- This does not apply to Ad Hoc orders that are created for immediate start.
Job Resource: eMailDefault
Category | Environment Variable | Argument | Description | Sample Value |
---|---|---|---|---|
Agent | MAIL_SMTP_FROM | from | E-Mail address from which the mail is being sent | js7@example.com |
MAIL_SMTP_FROM_NAME | from_name | Name of the E-Mail address that sends mail | JS7 JobScheduler | |
MAIL_SMTP_REPLY_TO | reply_to | E-Mail address for replies to mails | no-reply@example.com | |
MAIL_SMTP_HOST | mail.smtp.host | Hostname or IP Address of the mail server | mail.example.com | |
MAIL_SMTP_PORT | mail.smtp.port | SMTP Port of the mail server | 25 | |
MAIL_SMTP_TIMEOUT | mail.smtp.timeout | Timeout in ms for responses of the mail server | 5000 | |
MAIL_SMTP_CONNECTIONTIMEOUT | mail.smtp.connectiontimeout | Timeout in ms for establishing a connection to the mail server | 5000 |
Explanation:
- Note that e-mail settings are used for JS7 - Notifications - Configuration Element MailFragment.
- The names of Arguments and Environment Variables should not be changed.
- Any further Arguments and Environment Variables can be added that start with the prefix
mail.smtp.
andMAIL_SMTP_
respectively,- For example, to force support for TLS connections with a specific version of the protocol you can use:
- Argument:
mail.smtp.ssl.protocols,
value:TLSv1.2
Argument:
mail.smtp.starttls.enable
, value:true
- Argument:
- For authentication the following settings are used:
- the
mail.smtp.user
setting is assigned the SMTP user account. - the
mail.smtp.password
setting is assigned the password.
- the
- When using OAuth2 authentication then the following settings are used:
- the
mail.smtp.auth
setting is assigned the valuetrue
. - the
mail.smtp.auth.mechanisms
setting is assigned the valueXOAUTH2
. - the
mail.smtp.user
setting is assigned the OAuth2 user account. - the
mail.smtp.password
setting is assigned the OAuth2 access token. - Some mail servers such as smtp.office365.com might require the older SASL mechanism to be used:
- the
mail.smtp.sasl.mechanisms.oauth2.oauthToken
setting is assigned the OAuth2 access token. - the
mail.smtp.password
setting is not specified.
- the
- the
- For example, to force support for TLS connections with a specific version of the protocol you can use:
- Find the list of available settings for JavaMail from : https://javaee.github.io/javamail/docs/api/com/sun/mail/smtp/package-summary.html
Environment Variables from Job Properties
- Job properties allow environment variables that are forwarded to the job script to be specified.
- The values of environment variables can be specified from:
- constant string values
- order variables
- node arguments
- For details see
Explanation:
- Users are free to choose the names of environment variables compliant to their OS. Such names are automatically converted to uppercase letters.
- Environment variables can be assigned values from order variables and from node arguments. Such variables are preceded by a
$
and follow the spelling of the relevant variable or argument. - Caveat: Any existing environment variables with the same name will be overwritten from the job configuration. You can e.g. specify a
PATH
environment variable if the intention is to modify this OS environment variable for use with a specific job.