-
Notifications
You must be signed in to change notification settings - Fork 1.7k
how to execute jobs when start? #297
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
There is no way to do that with the schedule. I think the best workaround is to execute your job immediately, e.g.
|
The |
just run the func once |
@iziyang I made a fork that addresses almost all issues of this repo. This is how you could do what you want to do -> _, _ = c.AddJob("*/10 * * * * *", func() {
fmt.Println("this job runs as soon as cron is started, then at every 10th seconds", time.Now())
}, cron.RunOnStart) |
Now cron job execute when next ticker coming. For example, I set @every 5 min,but when I start my program, it must wait for 5 min to execute, I want execute when start.
The text was updated successfully, but these errors were encountered: