cron Schedule Syntax Reference
This section describes the syntax for defining scheduled executions using cron in the Alteryx Analytics Cloud. Typically, this method is used for repeated schedules.
Note
Time zone settings defined in the Trifacta Application page where you are specifying your cron schedule are used with the schedule. To use UTC time zone, select UTC
in the drop-down.
Overview of cron
The Alteryx Analytics Cloud allows you to make use of cron, a widely used syntax, for specifying times that recur at regular intervals. You can use cron to specify schedules on a per-minute or annual basis and arbitrary intervals in between.
Cron syntax
A cron scheduled is defined as a space-separated string of values. The following cron example defines a schedule to be triggered at 11:30:00pm on February 1:
minute | hour | day of month | month | day of week |
---|---|---|---|---|
30 | 23 | 1 | 2 | * |
When all values are matched, the cron job is triggered.
Note
Specification of seconds is not supported.
Wildcards:
In the above cron expression, the wildcard * can be used to match any accepted value, which means that the cron value type is not a factor in determining this schedule. Since the wildcard is applied to the day of week value, the schedule can be triggered on any day of the week.
Note
You must use the *
character in either the day-of-week or day-of-month fields. Specifying both fields in the same cron expression is not supported.
Legend:
Except for the final field (year), all fields are required in the cron expression. Special characters are described below the table.
Value | Type | Description | Supported Special Characters |
---|---|---|---|
30 | minute | 0-59 | , - * / |
23 | hour | 0-23 | , - * / |
1 | day of month | 1-31 | , - * / L W |
2 | month | 1-12 | , - * / |
* | day of week | 0 - 6 or Sun - Sat 0, Sun, SUN = Sunday 1, Mon, MON = Monday ... 6, Sat, SAT = Saturday | , - * / L # |
* | year | (Optional) You can specify year settings if needed. Default is * . | , - * / |
Special characters
You can use the following special characters in your cron expressions.
Character | Description |
---|---|
* | ("all values") - Wildcard to match all possible values in the field. For example, if you wanted your trigger to fire every minute of the 10pm hour, the minute character in the expression is |
- | Specify a range of values. For example, you could use |
, | Specify a discrete set of values. For example, an entry of |
/ | Specify increments of the field in the units of the field. For example, |
L | Last value accepted in the range is accepted in the following fields:
|
W | Specifies the nearest matching weekday. For example, an entry of Tip
|
# | Specifies the nth day of the month. Examples for the day-of-week field:
|
Examples
Below are some example cron schedules.
Hourly
Runs at minute 15 of every hour:
15 * * * *
Daily
Runs every day at 10pm:
0 22 * * *
Runs every minute of the 10pm hour every day:
* 22 * * *
Weekly
Runs every Tuesday at 3am:
0 3 * * 2
Weekdays
Runs each weekday at 8pm:
0 20 * * 1-5
Note that the above schedule runs at 10pm on Monday night and each night of the week at that time.
For each weekday morning, you might choose to start the schedules on Sunday, in which the day-of-week value starts with 0 and ends with 4.
Monthly
Runs the first day of each month at 2:30am:
30 2 1 * *
Runs at 3:30pm on the nearest weekday (W) to the 25th of the month:
30 15 25W * *
If the 25th is a Saturday, the above triggers on Friday the 24th.
If the 25th is a Sunday, the above triggers on Monday the 26th.
Yearly
Runs at midnight of January 1 each year:
0 0 1 1 * *
Other examples
Expression | Meaning |
---|---|
0 12 * * * | Fire at 12pm (noon) every day |
15 10 * * * | Fire at 10:15am every day |
15 10 * * * | Fire at 10:15am every day |
15 10 * * * * | Fire at 10:15am every day |
15 10 * * * 2017 | Fire at 10:15am every day during the year 2017 |
* 14 * * * | Fire every minute starting at 2pm and ending at 2:59pm, every day |
0/5 14 * * * | Fire every 5 minutes starting at 2pm and ending at 2:55pm, every day |
0/5 14,18 * * * | Fire every 5 minutes starting at 2pm and ending at 2:55pm, AND fire every 5 minutes starting at 6pm and ending at 6:55pm, every day |
0-5 14 * * * | Fire every minute starting at 2pm and ending at 2:05pm, every day |
10,44 14 * 3 WED | Fire at 2:10pm and at 2:44pm every Wednesday in the month of March. |
15 10 * * MON-FRI | Fire at 10:15am every Monday, Tuesday, Wednesday, Thursday and Friday |
15 10 15 * * | Fire at 10:15am on the 15th day of every month |
15 10 L * * | Fire at 10:15am on the last day of every month |
15 10 L-2 * * | Fire at 10:15am on the 2nd-to-last last day of every month |
15 10 * * 5L | Fire at 10:15am on the last Friday of every month |
15 10 * * 5L 2017-2019 | Fire at 10:15am on every last friday of every month during the years 2017, 2018 and 2019 |
15 10 * * 5#3 | Fire at 10:15am on the third Friday of every month |
0 12 1/5 * * | Fire at 12pm (noon) every 5 days every month, starting on the first day of the month. |
11 11 11 11 * | Fire every November 11th at 11:11am. |
Unsupported cron expressions
Note
The Trifacta Application does not support mixing /
and -
special characters in the same expressions.
Instead of expressing ranges in your cron syntax, you can reference all possible options.
Invalid expression | Valid expression |
---|---|
0 23 * 1-11/2 * * | 0 23 * 2,4,6,8,10 * * |
Invalid cron expressions
Expression | Meaning | Reason |
---|---|---|
15 10 * * * 2001 | Fire at 10:15am every day during the year 2001 | This cron expression is invalid because it will not generate any events in the future. |
* * * | - | The cron expression should contain 6 or 7 fields. |