golang --- cron

package main

import (
	l4g "github.com/alecthomas/log4go"
	"github.com/robfig/cron"
)

func text() {
	l4g.Info("text")
}

func main() {
	c := cron.New()
	c.AddFunc("* * * * * *", func() { text() })
	c.Start()
	select {}
}

 

After a complete enterprise project, there are often timed tasks, such as backup, data checking, requires frequent timed run, if we can turn the scheduled task, make a business system, by liunx cron under the same rules as to indicate the timing rule execution

Golang of cron package to help solve this problem.

 

Guess you like

Origin www.cnblogs.com/saryli/p/11372942.html