一个 Golang 作业调度包。
A currently maintained fork of this project has been migrated to https://github.com/go-co-op/gocron
Disclaimer: we (the maintainers) tried, with no luck, to get in contact with Jason (the repository owner) in order to add new maintainers or leave the project within an organization. Unfortunately, he hasn't replied for months now (March, 2020).
So, we decided to move the project to a new repository (as stated above), in order to keep the evolution of the project coming from as many people as possible. Feel free to reach over!
This package is currently looking for new maintainers (cause @jasonlvhit is in ICU). Please message @jasonlvhit if you are interested. goCron is a Golang job scheduling package which lets you run Go functions periodically at pre-determined interval using a simple, human-friendly syntax.
goCron is a Golang implementation of Ruby module clockwork and Python job scheduling package schedule, and personally, this package is my first Golang program, just for fun and practice.
See also this two great articles:
If you want to chat, you can find us at Slack!
Back to this package, you could just use this simple API as below, to run a cron scheduler.
…
and full test cases and document will be coming soon (help is wanted! If you want to contribute, pull requests are welcome).
If you need to prevent a job from running at the same time from multiple cron instances (like running a cron app from multiple servers), you can provide a Locker implementation and lock the required jobs.
gocron.SetLocker(lockerImplementation)
gocron.Every(1).Hour().Lock().Do(task)
Once again, thanks to the great works of Ruby clockwork and Python schedule package. BSD license is used, see the file License for detail.
Looking to contribute? Try to follow these guidelines:
Have fun!
diff time in work machine?
Dockerfile with gocron
.Do overrides existing cron tasks
How to make stop Scheduler?
About task execution time
exec time
Lock function, still run multiple times on multiple server instances
Support for standard Cron like definitions
Cron job exited after undefined amount of time
Hey, how do I set the last day of the month to be executed on time?