mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-09-12 17:46:20 +08:00
fix: 解决服务重启后计划任务状态错误的问题 (#3741)
This commit is contained in:
parent
10eef260d4
commit
a5304b66e3
1 changed files with 10 additions and 0 deletions
|
@ -3,6 +3,7 @@ package hook
|
||||||
import (
|
import (
|
||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
|
|
||||||
|
"github.com/1Panel-dev/1Panel/backend/app/model"
|
||||||
"github.com/1Panel-dev/1Panel/backend/app/repo"
|
"github.com/1Panel-dev/1Panel/backend/app/repo"
|
||||||
"github.com/1Panel-dev/1Panel/backend/constant"
|
"github.com/1Panel-dev/1Panel/backend/constant"
|
||||||
"github.com/1Panel-dev/1Panel/backend/global"
|
"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)
|
_, _ = cmd.Execf("%s sed -i '/CHANGE_USER_INFO=true/d' /usr/local/bin/1pctl", sudo)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
handleCronjobStatus()
|
||||||
handleSnapStatus()
|
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…
Add table
Reference in a new issue