Skip to content

toolkits/cron

 
 

Repository files navigation

cron

crontab for golang

peference

TODO	

usage

import (
	"fmt"
	"time"
	
	ncron "github.com/niean/cron"
)

func main() {
	// init cron
	c := ncron.New()

	// add cron job
	c.AddFunc("* * * * * *", func() { fmt.Println("Every second") })
	c.AddFuncCC("* * * * * *", func() { fmt.Println("Every second, with max Concurrrent 2"); time.Sleep(10 * time.Second)}, 2)

	// start cron
	c.Start()

	// keep alive
	select {}
}

reference

Packages

No packages published

Languages

  • Go 100.0%