v1.2.1

Schedule Syntax

Last updated

This page lists the spec formats Add accepts: five-field cron expressions, descriptors, and @every intervals.

Cron Expressions

Exactly five fields, evaluated in the configured Location:

Field Range
Minute 0-59
Hour 0-23
Day of month 1-31
Month 1-12
Day of week 0-6 (0 is Sunday)
Syntax Example Matching rule
* * Any value
n 30 Equals n
n-m 9-17 Between n and m inclusive
a,b,n-m 0,30 List, ranges allowed, duplicates removed
*/n */15 Field value divisible by n

n-m/s and month or weekday names are not supported. The next fire time starts at the following minute and advances minute by minute until all five fields match.

Descriptors and Intervals

Spec Equivalent
@yearly, @annually 0 0 1 1 *
@monthly 0 0 1 * *
@weekly 0 0 * * 0
@daily, @midnight 0 0 * * *
@hourly 0 * * * *
@every <duration> Parsed by time.ParseDuration; minimum 30 seconds; next fire = current fire time + duration

See Configuration for setting the timezone and Task API for parse errors.

中文