diff --git a/backend/init/hook/hook.go b/backend/init/hook/hook.go index 7422826cb..6dd0a9952 100644 --- a/backend/init/hook/hook.go +++ b/backend/init/hook/hook.go @@ -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 +}