Support for cron expressions
This topic describes the supported cron expressions that you can use to schedule automatic application update checks and automatic backups in the Admin Console. For more information, see the automatic updates documentation.
Syntax
Cron expressions using the following syntax:
<minute> <hour> <day-of-month> <month> <day-of-week>
Fields
The following table lists the required cron fields and supported values:
Field | Allowed Values | Allowed Special Characters |
---|---|---|
Minute | 0 through 59 | , - * |
Hour | 0 through 23 | , - * |
Day-of-month | 1 through 31 | , - * ? L W |
Month | 1 through 12 or JAN through DEC | , - * |
Day-of-week | 1 through 7 or SUN through SAT | , - * ? L |
Special characters
The following table describes the supported special characters:
Special Character | Description |
---|---|
Comma (, ) | Specifies a list or multiple values, which can be consecutive or not. For example, 1,2,4 in the Day-of-week field signifies every Monday, Tuesday, and Thursday. |
Dash (- ) | Specifies a contiguous range. For example, 4-6 in the Month field signifies April through June. |
Asterisk (* ) | Specifies that all of the values for the field are used. For example, using * in the Month field means that all of the months are included in the schedule. |
Question mark (? ) | Specifies that one or another value can be used. For example, enter 5 for Day-of-the-month and ? for Day-of-the-week to check for updates on the 5th day of the month, regardless of which day of the week it is. |
L | Specifies the last day of the month or week respectively for the Day-of-month or Day-of-week fields. |
W | Specifies the Nth occurrence or given day in the month. For example, the second Friday of the month is specified as 6#2 . |
Predefined schedules
The Admin Console supports common pre-defined schedules. You can use one of the following predefined values instead of a cron expression:
Schedule Value | Equivalent Cron Expression | Description |
---|---|---|
@yearly (or @annually) | 0 0 1 1 * | Runs once a year, at midnight on January 1. |
@monthly | 0 0 1 ** | Runs once a month, at midnight on the first of the month. |
@weekly | 0 0 ** 0 | Run once a week, at midnight on Saturday. |
@daily (or @midnight) | 0 0 ** * | Runs once a day, at midnight. |
@hourly | 0 ** ** | Runs once an hour, at the beginning of the hour. |
@default | 0 0,4,8,12,16,20 ** * | Selects the default schedule option (every 4 hours). |
Intervals
You can also schedule jobs to operate at fixed intervals, starting at the time the job is added or when cron is run:
@every DURATION
Replace DURATION with a string that’s accepted by time. ParseDuration, except seconds. Seconds aren’t supported. For more information about duration strings, see Go’s time.ParseDuration
documentation.
As with standard cron expressions, the interval doesn’t include the job runtime. For example, if a job is scheduled to run every 10 minutes, and the job takes 4 minutes to run, there are 6 minutes of idle time between each run.
Examples
The following examples show valid cron expressions to schedule checking for updates:
At 11:30 AM every day:
30 11 * * *
At 6:00 PM on the fourth Monday of every month:
0 18 ? * 2#4
At midnight on the last day of every month:
0 0 L * ?
After 1 hour and 45 minutes, and then every interval following that:
@every 1h45m