Files
2026-05-20 16:13:58 +08:00

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
}