You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
package main
import (
"fmt"
"github.com/go-co-op/gocron"
"time"
)
func main() {
// Create a new scheduler
s := gocron.NewScheduler(time.UTC)
// Schedule a job to run every 72 hours (3 days)
s.Every(72).Hours().Do(func() {
fmt.Println("Running task every 3 days!")
})
// Schedule a job to run every 336 hours (2 weeks)
s.Every(336).Hours().Do(func() {
fmt.Println("Running task every 2 weeks!")
})
// Start the scheduler
s.StartAsync()
// Keep the program running to allow scheduled jobs to execute
select {}
}
would be nice to use
@every 3d
instead of@every 72h
or
@every 2w
instead of@every 336h
because days and weeks are easy to define, months and years are harder...
continue go-co-op/gocron#679
The text was updated successfully, but these errors were encountered: