commandsjob variables

Job output & properties, command job commands & input, url and mail job subject & message definitions can include one or more variables, enabling the creation of generic jobs.

Usage

{{ variable [options] }}

Variables

dir.tmp Name of the operating system temporary directory. This is the value specified in the Java system property java.io.tmpdir, which on Linux is typically /tmp.
job.name Name of job. Supported options are short & encode.
job.description Description of job.
job.host Name of the host on which this job runs.
job.user Name of the user under which the job runs.
property Name of a job property.
random Random integer. Supported options are [minValue] maxValue. The defaults are 0 & 1 respectively.
time Time of execution. Supported options are offset, epoch & format.
Default format = dd/MM/yyyy HH:mm:ss z
event.message Message generated by event job.
event.output Output of event job. Supported options are first & last.
event.name Name of event job. Supported options are short & encode.
event.result Result of event job.
event.time Time of event. Supported options are epoch & format.
Default format = dd/MM/yyyy HH:mm:ss z
event.time.next Time event job is next scheduled to execute, if it has a schedule. Supported options are epoch & format.
Default format = dd/MM/yyyy HH:mm:ss z
event.value Exit value of event job.

Options

first

When first option is used with the event.output variable, only the first line of the event jobs output will be output.

last

When last option is used with the event.output variable, only the last line of the event jobs output will be output.

short

When the short option is used with the job.name & event.name variables, only the name of the job rather, than full path name, will be output. e.g. wakeup instead of /examples/wakeup.

encode

When the encode option is used with the job.name & event.name variables, any /, : or @ characters within the name will be converted to _ characters, and any leading / character will be removed. e.g. /examples/wakeup becomes examples_wakeup.

offset

The offset option is used adjust the execution date/time before it is formatted using the following format [-+]n[smhdMy], where s = seconds, m = minutes, h = hours, d = days, M = months and y = years.

If both offset & format are specfied, offset must specfied first.

epoch

Format time variables as milliseconds from the Unix epoch of 1970-01-01T00:00:00Z.

format

All date/time based variables support the following format string.

Letter Date or Time Component Presentation Examples
G Era designator Text AD
y Year Year 1996; 96
M Month in year Month July; Jul; 07
w Week in year Number 27
W Week in month Number 2
D Day in year Number 189
d Day in month Number 10
F Day of week in month Number 2
E Day name in week Text Tuesday; Tue
u Day number of week (1 = Monday, …, 7 = Sunday) Number 1
a Am/pm marker Text PM
H Hour in day (0-23) Number 0
k Hour in day (1-24) Number 24
K Hour in am/pm (0-11) Number 0
h Hour in am/pm (1-12) Number 12
m Minute in hour Number 30
s Second in minute Number 55
S Millisecond Number 978
z Time zone Time zone Pacific Standard Time; PST; GMT-08:00

For full details of the format string, see SimpleDateFormat

Notes:

  • all date/times are formatted using the timezone of the job, unless overridden by a TZ job property;
  • if an invalid format string is specified, the default for the variable will be used instead.

Examples

Job/event name insert

Job {{ job.name }} was started by {{ event.name }}

Job /examples/wakeup was started by /examples/sleepy

Job name and custom time insert

Job {{ job.name short }} was started {{ time EEE HH:mm z }}

Job wakeup was started Mon 10:15 Antarctica/Casey

Adjust the execution time

Today is {{ time EEEE }}, yesterday was {{ time -1d EEEE }}

Today is Monday, yesterday was Sunday

See also

Reference