forked from all_user/stat_center
30 lines
509 B
Go
30 lines
509 B
Go
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
|
|
}
|