Using Cron Expressions for Jira Automation Scheduled Trigger

Using Cron Expressions for Jira Automation Scheduled Trigger

Jira automation provides a range of triggers to make workflows more efficient and the scheduled trigger is my most frequently used options. However, while it's widely used, the default settings for scheduled triggers can be somewhat limited in terms of customization. This is where cron expressions come into play, providing a powerful tool to enhance the flexibility and specificity of your automation rules.

You can select how often you would like Jira to run you automation rules by using scheduled triggers.

When you selected Advanced for your schedule, you can then construct a cron expression for your interval.

What Is Cron Expression?

A cron expressions give you more control over the frequency, compared to the default schedules. For example, you could define a cron expression to run an automation rules from 9:00 am to 5:00 pm every day.

ℹ️
Cron by default uses UTC time zone.

A cron expression is a string of fields separated by spaces. Comprising six or seven fields, these expressions offer precise control over scheduling:

Allowed values Allowed Special characters Required
Second 0-59 , - * / Required
Minute 0-59 , - * / Required
Hour 0-23 , - * / Required
Day of month 1-31 , - * ? / L W Required
Month 1-12 or JAN-DEC , - * / Required
Day of week 0-6 or SUN-SAT , - * ? / L # Required
Year 1970-2099 , - * / Optional
ℹ️
Cron expression are not case-sensitive.

Here is an example:

0 15 8 ? JAN MON 2014

This literally translates to 0 seconds, 15 minutes, 8 hours, any day of the month, January, Monday, 2014.

In plain English, this represents 8:15 am on every Monday during January 2014.

The ? character means "no particular value". In this example, we've set the Day-of-month to no particular value. We don't need to specify it, as we've specified a Day-of-week value. Read more about special characters in the next section.
Special characters Description Example
Comma (,) Separates multiple values.

8:15 am on every Monday, Wednesday and Friday during January 2014:

0 15 8 ? JAN MON,WED,FRI 2014
Hyphen (-) Specifies a range of values.

8:15 am every Monday, Tuesday, Wednesday, Thursday, and Friday:

0 15 8 ? * MON-FRI
Asterisk (*) Represents all possible values for a field.

Every minute starting at 2:00 pm and ending at 2:59 pm, every day:

0 * 14 * * ?
Slash (/) Specifies increments of values.

Every 10 minutes, forever:

0 0/10 * * * ? *
Question Mark (?) No specific value; used in the day-of-month and day-of-week fields to avoid conflicts.

2:10 pm and 2:44 pm every Wednesday in the month of March.

0 10,44 14 ? 3 WED
L (Last) Refers to the last specified value.

8:15 am on the Last Weekday of everymonth

0 15 8 LW * ?
W (Weekday) Specifies the weekday (Monday-Friday) nearest the given day of the month.
For example, '1W' means 'the nearest weekday to the 1st of the month'.
(note that if the 1st is a Saturday, the email will be sent on
the nearest weekday within the same month, i.e. on Monday 3rd)

at midnight on the nearest weekday to the 15th of the month.

0 0 0 15W * ?
Hash (#) Specifies the nth occurrence of a weekday in the month.

at 12:00 PM on the third Friday of every month

0 0 12 ? * 5#3

Examples:

0 15 8 ? * * Every day at 8:15 pm.
0 15 8 * * ? Every day at 8:15 am.
0 0/5 9-16 ? * MON-FRI Every 5 min at 9:00 am to 4:55 pm from Monday-Friday everymonth.

Read more