mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-02-13 03:50:07 +08:00
![ssongliu](/assets/img/avatar_default.png)
* feat: Add usage scope for backup accounts * fix: 解决计划任务列表不显示备份账号的问题 * feat: 统一备份文件大小获取接口
21 lines
640 B
Go
21 lines
640 B
Go
package cron
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/1Panel-dev/1Panel/core/global"
|
|
"github.com/1Panel-dev/1Panel/core/init/cron/job"
|
|
"github.com/1Panel-dev/1Panel/core/utils/common"
|
|
"github.com/robfig/cron/v3"
|
|
)
|
|
|
|
func Init() {
|
|
nyc, _ := time.LoadLocation(common.LoadTimeZoneByCmd())
|
|
global.Cron = cron.New(cron.WithLocation(nyc), cron.WithChain(cron.Recover(cron.DefaultLogger)), cron.WithChain(cron.DelayIfStillRunning(cron.DefaultLogger)))
|
|
|
|
if _, err := global.Cron.AddJob("0 3 */31 * *", job.NewBackupJob()); err != nil {
|
|
global.LOG.Errorf("[core] can not add backup token refresh corn job: %s", err.Error())
|
|
}
|
|
global.Cron.Start()
|
|
}
|