https://github.com/zzerroo/zcrontab
zcrontab is a ticker based crontab task, support all crontab symbol,and crond is not needed
https://github.com/zzerroo/zcrontab
at crond crontab golang
Last synced: 6 months ago
JSON representation
zcrontab is a ticker based crontab task, support all crontab symbol,and crond is not needed
- Host: GitHub
- URL: https://github.com/zzerroo/zcrontab
- Owner: zzerroo
- License: mit
- Created: 2019-06-25T02:01:16.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2019-07-25T03:00:47.000Z (about 7 years ago)
- Last Synced: 2025-08-03T07:28:21.024Z (12 months ago)
- Topics: at, crond, crontab, golang
- Language: Go
- Homepage:
- Size: 13.7 KB
- Stars: 8
- Watchers: 0
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: readme-ch.md
- License: LICENSE
Awesome Lists containing this project
README
# ZCrontab
基于go的crontab任务处理器
- 基于ticker的任务处理机制,不依赖crond
- 支持任务的删除、回调
- crontab任务
- crontab全任务支持*,-,/及,等类型任务处理
- At 任务
- 支持特定时间的任务执行
- 支持重复任务
# 如何使用
- ## install
git clone https://github.com/zzerroo/zcrontab.git && cd zcrontab && glide install
- ## example
```go
import (
"fmt"
"time"
"ztimer/zcrontab"
)
func test(args interface{}) {
fmt.Println(args)
}
func main() {
zCrontab := zcrontab.NewZCrontab()
zCrontab.Crontab("* * * * *", test, "*")
zCrontab.Crontab("*/2 * * * *", test, "every 2 minute")
zCrontab.Crontab("* 15 * * *", test, "every minute 3")
zCrontab.Crontab("*/2 15,16 * * *", test, "every 2 minute 3,4")
zCrontab.Crontab("*/2 15-16 * * *", test, "every 2 minute 3-4")
zCrontab.Crontab("* 15-16/2 * * *", test, "every minute 3-4/3")
zCrontab.At(time.Now().Add(1*time.Minute), test, "this is test for at repeat", true)
zCrontab.At(time.Now().Add(1*time.Minute), test, "this is test for at", false)
select {}
}
```
# 第三方库
github.com/gorhill/cronexpr
github.com/satori/go.uuid