task.go 288 B

12345678910111213141516
  1. package utils
  2. import (
  3. "github.com/robfig/cron"
  4. "server/task"
  5. )
  6. func ScheduledTask() {
  7. c := cron.New()
  8. //每五分钟监测状态
  9. _ = c.AddFunc("0 */5 * * * ?", func() { //_ = c.AddFunc("0/10 * * * * ?", func() {
  10. //巡检网关
  11. task.GatewayRoutingInspection()
  12. })
  13. c.Start()
  14. }