task.go 325 B

1234567891011121314151617
  1. package initialize
  2. import (
  3. "github.com/robfig/cron"
  4. "server/edge/camera"
  5. )
  6. func TimeTasks() {
  7. c := cron.New()
  8. //每五分钟监测状态
  9. //_ = c.AddFunc("0 */5 * * * ?", func() {
  10. _ = c.AddFunc("0/5 * * * * ?", func() {
  11. //检查摄像头是否在线
  12. camera.TestCameraOnline(camera.CameraDevices)
  13. })
  14. c.Start()
  15. }