Initial commit
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
package monitorSer
|
||||
|
||||
import (
|
||||
"github.com/robfig/cron/v3"
|
||||
"stat/common/log"
|
||||
"stat/common/statutils"
|
||||
)
|
||||
|
||||
var (
|
||||
auto *cron.Cron
|
||||
)
|
||||
|
||||
func init() {
|
||||
auto = cron.New(cron.WithSeconds(), cron.WithChain(cron.SkipIfStillRunning(&log.Logger{}))) // 秒级定时任务
|
||||
}
|
||||
|
||||
func InitMonitor() {
|
||||
_, _ = auto.AddFunc("0 1 * * * ?", func() {
|
||||
statutils.ServerMon.RunWithName(func() error {
|
||||
return MonitorCheck()
|
||||
}, statutils.GetFuncName(MonitorCheck))
|
||||
})
|
||||
|
||||
auto.Start()
|
||||
}
|
||||
|
||||
func MonitorCheck() error {
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user