mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-01-19 16:29:17 +08:00
22 lines
420 B
Go
22 lines
420 B
Go
|
package cron
|
||
|
|
||
|
import (
|
||
|
"time"
|
||
|
|
||
|
"github.com/1Panel-dev/1Panel/cron/job"
|
||
|
"github.com/1Panel-dev/1Panel/global"
|
||
|
"github.com/robfig/cron/v3"
|
||
|
)
|
||
|
|
||
|
func Run() {
|
||
|
nyc, _ := time.LoadLocation("Asia/Shanghai")
|
||
|
Cron := cron.New(cron.WithLocation(nyc))
|
||
|
_, err := Cron.AddJob("@every 1m", job.NewMonitorJob())
|
||
|
if err != nil {
|
||
|
global.LOG.Errorf("can not add corn job: %s", err.Error())
|
||
|
}
|
||
|
Cron.Start()
|
||
|
|
||
|
global.Corn = Cron
|
||
|
}
|