在 go 中使用 cron
官方文档 - https://pkg.go.dev/github.com/robfig/cron#section-readme
这篇文章写的也不错 - https://segmentfault.com/a/1190000023029219
1 | package main |
更新到V3,要注意文档中说的
The v1 branch accepted an optional seconds field at the beginning of the cron spec. This is non-standard and has led to a lot of confusion. The new default parser conforms to the standard as described by the Cron wikipedia page.
UPDATING: To retain the old behavior, construct your Cron with a custom parser:
1 | // Seconds field, required |