Skip to content

zcrontab is a ticker based crontab task, support all crontab symbol,and crond is not needed

License

Notifications You must be signed in to change notification settings

zzerroo/zcrontab

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ZCrontab

zcrontab is a crontab、at task processor based on golang:

  • based on time.ticker,no need of crond service

  • support task deletion and callback

  • crontab

    • the crontab task support all crontab symbol including *,-,/,,
  • at

    • the at task can be repeated at the same time(every day)

Usage

Install

glide get github.com/zzerroo/zcrontab

example

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 {}
}

About

zcrontab is a ticker based crontab task, support all crontab symbol,and crond is not needed

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages