Skip to content

Latest commit

 

History

History
35 lines (26 loc) · 463 Bytes

README.md

File metadata and controls

35 lines (26 loc) · 463 Bytes

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