https://github.com/keepchen/schedule
A distributed scheduled task tool written in Go.
https://github.com/keepchen/schedule
cronjob crontab-task schedule
Last synced: 14 days ago
JSON representation
A distributed scheduled task tool written in Go.
- Host: GitHub
- URL: https://github.com/keepchen/schedule
- Owner: keepchen
- License: mit
- Created: 2024-06-28T07:07:15.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-07-16T03:04:15.000Z (over 1 year ago)
- Last Synced: 2025-12-18T14:56:33.627Z (3 months ago)
- Topics: cronjob, crontab-task, schedule
- Language: Go
- Homepage:
- Size: 19.5 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Schedule
[](https://github.com/keepchen/schedule/actions/workflows/go.yml) [](https://github.com/keepchen/schedule/actions/workflows/codeql.yml) [](https://goreportcard.com/report/github.com/keepchen/schedule)
A distributed scheduled task tool written in Go. It was incubated and evolved from the [go-sail](https://github.com/keepchen/go-sail) framework.
### Requirement
```text
go version >= 1.19
```
### Installation
```shell
go get -u github.com/keepchen/schedule
```
### Features
- [x] Interval task
- [x] Once time task
- [x] Linux Crontab Style task
- [x] Cancelable
- [x] Race detection
- [x] Manual call
### Examples
#### Interval
```go
schedule.NewJob("say hello").EveryMinute()
```
#### Once time
```go
schedule.NewJob("check in").RunOnceTimeAfter(time.Second)
```
#### Linux Crontab Style
```go
schedule.NewJob("good morning").RunAt(schedule.EveryDayOfEightAMClock)
```
#### Cancelable
```go
cancel := schedule.NewJob("say hello").EveryMinute()
time.AfterFunc(time.Minute*3, cancel)
```
#### Race detection
> Note: You must set redis provider before use.
```go
// set redis provider
schedule.SetRedisProviderStandalone(...)
// or
schedule.SetRedisProviderClient(...)
schedule.NewJob("say hello").WithoutOverlapping().EveryMinute()
```
#### Manual call
```go
schedule.Call("say hello", false)
schedule.MustCall("task not exist will be panic", true)
```