Skip to content

Commit

Permalink
feat: 日志倒序输出
Browse files Browse the repository at this point in the history
  • Loading branch information
devhaozi committed Nov 28, 2023
1 parent a80ddfa commit e4e3ad5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions app/http/controllers/task_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ func (r *TaskController) Log(ctx http.Context) http.Response {
return ErrorSystem(ctx)
}

log, err := tools.Exec("tail -n 1000 " + task.Log)
log, err := tools.Exec("tail -n 1000 " + task.Log + " | tac")
if err != nil {
return Error(ctx, http.StatusInternalServerError, log)
return Error(ctx, http.StatusInternalServerError, "日志已被清理")
}

return Success(ctx, log)
Expand Down
8 changes: 4 additions & 4 deletions pkg/tools/tools.go
Original file line number Diff line number Diff line change
Expand Up @@ -474,10 +474,6 @@ func UpdatePanel(panelInfo PanelInfo) error {
if !Exists("/www/panel/database/panel.db") || !Exists("/www/panel/panel.conf") {
return errors.New("恢复面板配置失败")
}
if _, err = Exec("/www/panel/panel --env=panel.conf artisan migrate"); err != nil {
color.Redln("运行面板数据库迁移失败")
return err
}
color.Greenln("恢复完成")

color.Greenln("设置面板文件权限...")
Expand All @@ -487,6 +483,10 @@ func UpdatePanel(panelInfo PanelInfo) error {
}
color.Greenln("设置完成")

if _, err = Exec("/www/panel/panel --env=panel.conf artisan migrate"); err != nil {
color.Redln("运行面板数据库迁移失败")
return err
}
if _, err = Exec("bash /www/panel/scripts/update_panel.sh"); err != nil {
color.Redln("执行面板升级后脚本失败")
return err
Expand Down

0 comments on commit e4e3ad5

Please sign in to comment.