# cron **Repository Path**: yashan_tech/cron ## Basic Information - **Project Name**: cron - **Description**: https://github.com/robfig/cron - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: yasdb-3.0.2 - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 1 - **Created**: 2025-01-03 - **Last Updated**: 2025-01-15 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # yascron To download the specific tagged release, run: go get git.yasdb.com/yascron Import it in your program as: import "git.yasdb.com/yascron" It requires Go 1.19 or later due to usage of Go Modules. Usage Callers may register Tasks to be invoked on a given schedule. yascron will run them in their own goroutines. c := New(WithLogger(...)) t1 := NewCronTask("hour", "30 * * * *", func() { fmt.Println("Every hour on the half hour") }) t2 := NewCronTask("range", "30 3-6,20-23 * * *", func() { fmt.Println(".. in the range 3-6am, 8-11pm") }) t3 := NewCronTask("day", "CRON_TZ=Asia/Tokyo 30 04 * * * *", func() { fmt.Println("Runs at 04:30 Tokyo time every day") }) c.AddTask(t1) c.AddTask(t2) c.AddTask(t3) c.Start() ... c.Stop() // Stop the scheduler (does not stop any jobs already running). CRON Expression Format A cron expression represents a set of times, using 5 space-separated fields. Field name | Mandatory? | Allowed values | Allowed special characters ---------- | ---------- | -------------- | -------------------------- Minutes | Yes | 0-59 | * / , - Hours | Yes | 0-23 | * / , - Day of month | Yes | 1-31 | * / , - ? Month | Yes | 1-12 or JAN-DEC | * / , - Day of week | Yes | 0-6 or SUN-SAT | * / , - ? Month and Day-of-week field values are case insensitive. "SUN", "Sun", and "sun" are equally accepted. The specific interpretation of the format is based on the Cron Wikipedia page: https://en.wikipedia.org/wiki/Cron Thanks for github.com/robfig/cron!