mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2024-11-27 20:49:03 +08:00
fix: 解决服务重启后计划任务状态错误的问题 (#3741)
This commit is contained in:
parent
10eef260d4
commit
a5304b66e3
@ -3,6 +3,7 @@ package hook
|
||||
import (
|
||||
"encoding/base64"
|
||||
|
||||
"github.com/1Panel-dev/1Panel/backend/app/model"
|
||||
"github.com/1Panel-dev/1Panel/backend/app/repo"
|
||||
"github.com/1Panel-dev/1Panel/backend/constant"
|
||||
"github.com/1Panel-dev/1Panel/backend/global"
|
||||
@ -70,6 +71,7 @@ func Init() {
|
||||
_, _ = cmd.Execf("%s sed -i '/CHANGE_USER_INFO=true/d' /usr/local/bin/1pctl", sudo)
|
||||
}
|
||||
|
||||
handleCronjobStatus()
|
||||
handleSnapStatus()
|
||||
}
|
||||
|
||||
@ -117,3 +119,11 @@ func handleSnapStatus() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func handleCronjobStatus() {
|
||||
_ = global.DB.Model(&model.JobRecords{}).Where("status = ?", constant.StatusWaiting).
|
||||
Updates(map[string]interface{}{
|
||||
"status": constant.StatusFailed,
|
||||
"message": "the task was interrupted due to the restart of the 1panel service",
|
||||
}).Error
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user