Skip to content
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

How to start job from the past time? #512

Open
BugKillerPro opened this issue Feb 20, 2024 · 0 comments
Open

How to start job from the past time? #512

BugKillerPro opened this issue Feb 20, 2024 · 0 comments

Comments

@BugKillerPro
Copy link

BugKillerPro commented Feb 20, 2024

       parser := cron.NewParser(
		cron.Second | cron.Minute | cron.Hour | cron.Dom | cron.Month | cron.Dow | cron.Descriptor,
	)
	c := cron.New(cron.WithParser(parser))

	// 0 0 */5 * *
	c.AddFunc("0 0 0 */5 * ?", func() {
		fmt.Println("Every 5 day")
	})

If this program run at 2024-01-01,then fmt.Println("Every 5 day") will run at 2024-01-06、2024-01-11 ......,
but if I restart this program at 2024-01-02,then fmt.Println("Every 5 day") will run at 2024-01-07、2024-01-12 .......,
So ,How to avoid restart influence?or How to start job from the past time? or How to set a specific past time as original cron start time ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant