Overview
Cron triggers are used to create a build schedule based on events in time. For example, you may wish to perform a build at regular intervals (every 15 minutes), at a certain time of the day (1:00am) or only on certain days (Monday-Friday). These schedules and many more may be described succinctly using a single cron-like string.
Configuration
Configuration of a cron trigger requires a single field, the cron expression.
cron expression
A succint string representation of the times at which this trigger should fire. Cron schedules in pulse™ are implemented using the open source scheduler Quartz
. For full documentation regarding Quartz cron expressions, refer to http://www.opensymphony.com/quartz/api/org/quartz/CronExpression.html
. Relevant details have been duplicated below with some modification:
A cron expression is broken down into the following fields:
| Field |
Allowed Values |
Allowed Special Characters |
| Seconds |
0-59 |
, - * / |
| Minutes |
0-59 |
, - * / |
| Hours |
0-23 |
, - * / |
| Day-of-month |
1-31 |
, - * ? / L W C |
| Month |
1-12 or JAN-DEC |
, - * / |
| Day-of-week |
1-7 or SUN-SAT |
, - * ? / L C # |
| Year (Optional) |
empty, 1970-2099 |
, - * / |
The fields should be composed in order to form a single string:
This string specifies a time, or when wildcards are used a set of times, at which the trigger should fire. Note that only one of the day-of-month and day-of-week fields is allowed: the other should be set to '?'. The special characters have the following meanings:
| Character |
Meaning |
| , |
Used to separate an explicit list of possibilities for the field, e.g. "MON,WED,FRI". |
| - |
Used to specify a range of values for the field, e.g. "2-9". |
| * |
All values, e.g. a * in the hours field means "any hour". |
| / |
Used to specify a set of regularly-spaced possibilites, e.g. "0/15" in the seconds field means "every 15 seconds, starting at 0", and is equivalent to "0,15,30,45". |
| ? |
Used on the day-of-month and day-of-week fields to mean "no specific value", required to specify a value in one of these fields but not the other. |
| L |
Used in the day-of-month or day-of-week field to mean "last day of the month" or "last day of the week" ("SAT") respectively. In the day-of-week field you may also specify a value before the L, to mean "last <nth>day of the month", e.g. "6L" means "last Friday of the month". |
| W |
Used in the day-of-month field to specify the nearest working (Monday-Friday) day to a numbered day. For example, "15W" means "nearest working day to the 15th of the month". If the 15th is a Saturday, the trigger will fire on Friday the 14th. May also be combined with the L character as "LW" to mean "last working day of the month". |
| # |
Used in the day-of-week field between a day number and a numbered occurence of that day. For example "6#3" means "the third Friday of the month". |
Examples
Trigger once every hour, at 15 past the hour:
Trigger every half an hour, at 0 and 30 minutes passed the hour:
Fire at noon every day:
Fire at 10:15am every Monday, Tuesday, Wednesday, Thursday and Friday: