Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
G

go-quartz

> 编程语言
Open source

Minimalist and zero-dependency scheduling library for Go

2.0K stars0 likes1 views
WebsiteGitHub

About

Minimalist and zero-dependency scheduling library for Go

go-quartz

A minimalistic and zero-dependency scheduling library for Go.

About

The implementation is inspired by the design of the Quartz Java scheduler.

The core scheduler component can be used to manage scheduled jobs (tasks) using triggers. The implementation of the cron trigger fully supports the Quartz cron expression format and can be used independently to calculate a future time given the previous execution time.

If you need to run multiple instances of the scheduler, see the distributed mode section for guidance.

Library building blocks

Scheduler interface

…

Implemented Schedulers

  • StdScheduler

Trigger interface

go
type Trigger interface {
	// NextFireTime returns the next time at which the Trigger is scheduled to fire.
	NextFireTime(prev int64) (int64, error)

	// Description returns the description of the Trigger.
	Description() string
}

Implemented Triggers

  • CronTrigger
  • SimpleTrigger
  • RunOnceTrigger

Job interface

Any type that implements it can be scheduled.

go
type Job interface {
	// Execute is called by a Scheduler when the Trigger associated with this job fires.
	Execute(context.Context) error

	// Description returns the description of the Job.
	Description() string
}

Several common Job implementations can be found in the job package.

Cron expression format

Field Name Mandatory Allowed Values Allowed Special Characters
Seconds YES 0-59 , - * /
Minutes YES 0-59 , - * /
Hours YES 0-23 , - * /
Day of month YES 1-31 , - * ? / L W
Month YES 1-12 or JAN-DEC , - * /
Day of week YES 1-7 or SUN-SAT , - * ? / L #
Year NO empty, 1970- , - * /

Special characters

  • *: All values in a field (e.g., * in minutes = "every minute").
  • ?: No specific value; use when specifying one of two related fields (e.g., "10" in day-of- month, ? in day-of-week).
  • -: Range of values (e.g., 10-12 in hour = "hours 10, 11, and 12").
  • ,: List of values (e.g., MON,WED,FRI in day-of-week = "Monday, Wednesday, Friday").
  • /: Increments (e.g., 0/15 in seconds = "0, 15, 30, 45"; 1/3 in day-of-month = "every 3 days from the 1st").
  • L: Last day; meaning varies by field. Ranges or lists are not allowed with L.
    • Day-of-month: Last day of the month (e.g, L-3 is the third to last day of the month).
    • Day-of-week: Last day of the week (7 or SAT) when alone; "last xxx day" when used after another value (e.g., 6L = "last Friday").
  • W: Nearest weekday in the month to the given day (e.g., 15W = "nearest weekday to the 15th"). If 1W on Saturday, it fires Monday the 3rd. W only applies to a single day, not ranges or lists.
  • #: Nth weekday of the month (e.g., 6#3 = "third Friday"; 2#1 = "first Monday"). Firing does not occur if that nth weekday does not exist in the month.

1 The L and W characters can also be combined in the day-of-month field to yield LW, which translates to "last weekday of the month".

2 The names of months and days of the week are not case-sensitive. MON is the same as mon.

Distributed mode

The scheduler can use its own implementation of quartz.JobQueue to allow state sharing.
An example implementation of the job queue using the file system as a persistence layer can be found here.

Usage example

…

See the examples directory for additional code samples.

License

Licensed under the MIT License.

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Gocroncronjobcrontabgo

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言