Skip to content

Commit

Permalink
feat: 更新前检查临时文件
Browse files Browse the repository at this point in the history
  • Loading branch information
devhaozi committed Nov 23, 2023
1 parent d55bb5f commit 596cd68
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/tools/tools.go
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,11 @@ func UpdatePanel(panelInfo PanelInfo) error {
color.Greenln("目标版本: " + panelInfo.Version)
color.Greenln("下载链接: " + panelInfo.DownloadUrl)

color.Greenln("前置检查...")
if Exists("/tmp/panel.db.bak") || Exists("/tmp/panel.conf.bak") {
return errors.New("检测到/tmp存在临时文件,可能是上次更新失败导致的,请谨慎排除后重试")
}

color.Greenln("备份面板配置...")
if _, err := Exec("cp -f /www/panel/database/panel.db /tmp/panel.db.bak"); err != nil {
color.Redln("备份面板数据库失败")
Expand Down

0 comments on commit 596cd68

Please sign in to comment.