Cron
A cron job is an Empty verb that will be called on a schedule. The syntax is described here.
You can also use a shorthand syntax for the cron job, supporting seconds (s
), minutes (m
), hours (h
), and specific days of the week (e.g. Mon
).
Examples
The following function will be called hourly:
//ftl:cron 0 * * * *
func Hourly(ctx context.Context) error {
// ...
}
Every 12 hours, starting at UTC midnight:
//ftl:cron 12h
func TwiceADay(ctx context.Context) error {
// ...
}
Every Monday at UTC midnight:
//ftl:cron Mon
func Mondays(ctx context.Context) error {
// ...
}