package main import ( "fmt" "github.com/robfig/cron" ) func main() { //var lock sync.Mutex //exportFileFlag := true c := cron.New() c.AddFunc("*/10 * * * * ?", func() { fmt.Println(".. in the range 3-6am, 8-11pm") }) //c.AddFunc("*/5 * * * * ?", func() { // fmt.Println(time.Now()) //if exportFileFlag == true { // //lock.Lock() // //exportFileFlag = false // //lock.Unlock() // fmt.Println(time.Now()) // time.Sleep(3 * time.Second) // //lock.Lock() // //exportFileFlag = true // //lock.Unlock() //} else { // fmt.Println(time.Now(), "2222222") //} //}) c.Start() select {} }