Skip to main content Link Search Menu Expand Document (external link)


There are three ways of creating a cron trigger:

Using a cron expression

rule 'Using Cron Syntax' do
  cron '43 46 13 ? * ?'
  run { "Cron rule executed" }

Using cron fields

Cron Field Names

second:Defaults to * when not specified
minute:Defaults to * when not specified
hour:Defaults to * when not specified
dom:Day of month. Defaults to ? when not specified
month:Defaults to * when not specified
dow:Day of week. Defaults to ? when not specified
year:Defaults to * when not specified

Each field is optional, but at least one must be specified. The same rules for the standard cron expression apply for each field. For example, multiple values can be separated with a comma within a string. Omitted fields will default to * or ? as applicable.

# Run every 3 minutes on Monday to Friday
# equivalent to the cron expression '0 */3 * ? * MON-FRI *'
rule 'Using cron fields' do
  cron second: 0, minute: '*/3', dow: 'MON-FRI'
  run { "Cron rule executed" }

Using Every syntax

See: every