修改配置.

This commit is contained in:
lijiahang
2024-05-07 11:35:08 +08:00
parent 908c4a3345
commit 1379150369
9 changed files with 48 additions and 42 deletions

View File

@@ -30,7 +30,7 @@
**github:** https://github.com/lijiahangmax/orion-ops-pro **github:** https://github.com/lijiahangmax/orion-ops-pro
**gitee:** https://gitee.com/lijiahangmax/orion-ops-pro **gitee:** https://gitee.com/lijiahangmax/orion-ops-pro
**文档:** https://lijiahangmax.gitee.io/orion-ops-pro/#/ **文档:** https://lijiahangmax.github.io/orion-ops-pro/#/
**demo:** http://101.43.254.243:1081/ **demo:** http://101.43.254.243:1081/
演示账号: `admin` 演示账号: `admin`
@@ -53,11 +53,11 @@
## 快速开始 ## 快速开始
* [docker安装](https://lijiahangmax.gitee.io/orion-ops-pro/#/quickstart/docker-install) * [docker安装](https://lijiahangmax.github.io/orion-ops-pro/#/quickstart/docker-install)
* [普通安装](https://lijiahangmax.gitee.io/orion-ops-pro/#/quickstart/install) * [普通安装](https://lijiahangmax.github.io/orion-ops-pro/#/quickstart/install)
* [更新日志](https://lijiahangmax.gitee.io/orion-ops-pro/#/about/change-log) * [更新日志](https://lijiahangmax.github.io/orion-ops-pro/#/about/change-log)
* [操作手册](https://lijiahangmax.gitee.io/orion-ops-pro/#/operator/asset) * [操作手册](https://lijiahangmax.github.io/orion-ops-pro/#/operator/asset)
* [常见问题](https://lijiahangmax.gitee.io/orion-ops-pro/#/quickstart/faq) * [常见问题](https://lijiahangmax.github.io/orion-ops-pro/#/quickstart/faq)
## 技术栈 ## 技术栈

View File

@@ -30,7 +30,7 @@
**github:** https://github.com/lijiahangmax/orion-ops-pro **github:** https://github.com/lijiahangmax/orion-ops-pro
**gitee:** https://gitee.com/lijiahangmax/orion-ops-pro **gitee:** https://gitee.com/lijiahangmax/orion-ops-pro
**文档:** https://lijiahangmax.gitee.io/orion-ops-pro/#/ **文档:** https://lijiahangmax.github.io/orion-ops-pro/#/
**demo:** http://101.43.254.243:1081/ **demo:** http://101.43.254.243:1081/
演示账号: `admin` 演示账号: `admin`
@@ -53,11 +53,11 @@
## 快速开始 ## 快速开始
* [docker安装](https://lijiahangmax.gitee.io/orion-ops-pro/#/quickstart/docker-install) * [docker安装](/quickstart/docker-install)
* [普通安装](https://lijiahangmax.gitee.io/orion-ops-pro/#/quickstart/install) * [普通安装](/quickstart/install)
* [更新日志](https://lijiahangmax.gitee.io/orion-ops-pro/#/about/change-log) * [更新日志](/about/change-log)
* [操作手册](https://lijiahangmax.gitee.io/orion-ops-pro/#/operator/asset) * [操作手册](/operator/asset)
* [常见问题](https://lijiahangmax.gitee.io/orion-ops-pro/#/quickstart/faq) * [常见问题](/quickstart/faq)
## 技术栈 ## 技术栈

View File

@@ -14,6 +14,7 @@
* 🐞 修复 查看计划任务日志时提示日志不存在 * 🐞 修复 查看计划任务日志时提示日志不存在
* 🩰 修改 命令执行日志 UI 修改 * 🩰 修改 命令执行日志 UI 修改
* 🌈 新增 文件传输列表添加操作栏 * 🌈 新增 文件传输列表添加操作栏
* 🌈 新增 主机在线会话
* 🔨 优化 * 🔨 优化
[如何升级](/update/v1.0.7.md) [如何升级](/update/v1.0.7.md)

View File

@@ -184,7 +184,7 @@ app:
# 自动清理执行文件 # 自动清理执行文件
auto-clear: true auto-clear: true
# 保留周期 (天) # 保留周期 (天)
keep-period: 60 keep-period: 30
# orion framework config # orion framework config
orion: orion:

View File

@@ -34,7 +34,7 @@ public class AppExecLogConfig {
public AppExecLogConfig() { public AppExecLogConfig() {
this.appendAnsi = true; this.appendAnsi = true;
this.autoClear = true; this.autoClear = true;
this.keepPeriod = 60; this.keepPeriod = 30;
} }
} }

View File

@@ -31,16 +31,16 @@ public class ExecCommandAnsiHandler extends BaseExecCommandHandler {
super.initLogOutputStream(); super.initLogOutputStream();
// 拼接启动日志 // 拼接启动日志
AnsiAppender appender = AnsiAppender.create() AnsiAppender appender = AnsiAppender.create()
.append(AnsiForeground.BRIGHT_GREEN.and(AnsiFont.BOLD), "> 准备执行命令 ") .append(AnsiForeground.GREEN.and(AnsiFont.BOLD), "> 准备执行命令 ")
.append(Dates.current()) .append(Dates.current())
.newLine() .newLine()
.append(AnsiForeground.BRIGHT_BLUE.and(AnsiFont.BOLD), "执行记录: ") .append(AnsiForeground.BLUE.and(AnsiFont.BOLD), "执行记录: ")
.append(execCommand.getLogId()) .append(execCommand.getLogId())
.newLine() .newLine()
.append(AnsiForeground.BRIGHT_BLUE.and(AnsiFont.BOLD), "执行描述: ") .append(AnsiForeground.BLUE.and(AnsiFont.BOLD), "执行描述: ")
.append(execCommand.getDescription()) .append(execCommand.getDescription())
.newLine() .newLine()
.append(AnsiForeground.BRIGHT_BLUE.and(AnsiFont.BOLD), "执行用户: ") .append(AnsiForeground.BLUE.and(AnsiFont.BOLD), "执行用户: ")
.append(execCommand.getUsername()); .append(execCommand.getUsername());
// 非系统用户执行添加 userId // 非系统用户执行添加 userId
if (Const.SYSTEM_USER_ID.equals(execCommand.getUserId())) { if (Const.SYSTEM_USER_ID.equals(execCommand.getUserId())) {
@@ -53,35 +53,35 @@ public class ExecCommandAnsiHandler extends BaseExecCommandHandler {
} }
// 执行序列 // 执行序列
if (execCommand.getExecSeq() != null) { if (execCommand.getExecSeq() != null) {
appender.append(AnsiForeground.BRIGHT_BLUE.and(AnsiFont.BOLD), "执行序列: ") appender.append(AnsiForeground.BLUE.and(AnsiFont.BOLD), "执行序列: ")
.append('#') .append('#')
.append(execCommand.getExecSeq()) .append(execCommand.getExecSeq())
.newLine(); .newLine();
} }
appender.append(AnsiForeground.BRIGHT_BLUE.and(AnsiFont.BOLD), "执行主机: ") appender.append(AnsiForeground.BLUE.and(AnsiFont.BOLD), "执行主机: ")
.append(execHostCommand.getHostName()) .append(execHostCommand.getHostName())
.append(" (") .append(" (")
.append(execHostCommand.getHostId()) .append(execHostCommand.getHostId())
.append(")") .append(")")
.newLine() .newLine()
.append(AnsiForeground.BRIGHT_BLUE.and(AnsiFont.BOLD), "主机地址: ") .append(AnsiForeground.BLUE.and(AnsiFont.BOLD), "主机地址: ")
.append(execHostCommand.getHostAddress()) .append(execHostCommand.getHostAddress())
.newLine() .newLine()
.append(AnsiForeground.BRIGHT_BLUE.and(AnsiFont.BOLD), "超时时间: ") .append(AnsiForeground.BLUE.and(AnsiFont.BOLD), "超时时间: ")
.append(execCommand.getTimeout()) .append(execCommand.getTimeout())
.newLine() .newLine()
.append(AnsiForeground.BRIGHT_BLUE.and(AnsiFont.BOLD), "脚本执行: ") .append(AnsiForeground.BLUE.and(AnsiFont.BOLD), "脚本执行: ")
.append(execCommand.getScriptExec()) .append(execCommand.getScriptExec())
.newLine() .newLine()
.newLine() .newLine()
.append(AnsiForeground.BRIGHT_GREEN.and(AnsiFont.BOLD), "> 执行命令 ") .append(AnsiForeground.GREEN.and(AnsiFont.BOLD), "> 执行命令 ")
.newLine() .newLine()
.append(execHostCommand.getCommand()) .append(execHostCommand.getCommand())
.newLine() .newLine()
.newLine(); .newLine();
// 非脚本执行拼接开始执行日志 // 非脚本执行拼接开始执行日志
if (!Booleans.isTrue(execCommand.getScriptExec())) { if (!Booleans.isTrue(execCommand.getScriptExec())) {
appender.append(AnsiForeground.BRIGHT_GREEN.and(AnsiFont.BOLD), "> 开始执行命令 ") appender.append(AnsiForeground.GREEN.and(AnsiFont.BOLD), "> 开始执行命令 ")
.append(Dates.current()) .append(Dates.current())
.newLine(); .newLine();
} }
@@ -94,10 +94,10 @@ public class ExecCommandAnsiHandler extends BaseExecCommandHandler {
// 拼接上传日志 // 拼接上传日志
AnsiAppender startAppender = AnsiAppender.create() AnsiAppender startAppender = AnsiAppender.create()
.newLine() .newLine()
.append(AnsiForeground.BRIGHT_GREEN.and(AnsiFont.BOLD), "> 准备上传脚本 ") .append(AnsiForeground.GREEN.and(AnsiFont.BOLD), "> 准备上传脚本 ")
.append(Dates.current()) .append(Dates.current())
.newLine() .newLine()
.append(AnsiForeground.BRIGHT_BLUE.and(AnsiFont.BOLD), "文件路径: ") .append(AnsiForeground.BLUE.and(AnsiFont.BOLD), "文件路径: ")
.append(execHostCommand.getScriptPath()) .append(execHostCommand.getScriptPath())
.newLine(); .newLine();
this.appendLog(startAppender); this.appendLog(startAppender);
@@ -105,18 +105,18 @@ public class ExecCommandAnsiHandler extends BaseExecCommandHandler {
super.uploadScriptFile(); super.uploadScriptFile();
// 拼接完成日志 // 拼接完成日志
AnsiAppender finishAppender = AnsiAppender.create() AnsiAppender finishAppender = AnsiAppender.create()
.append(AnsiForeground.BRIGHT_GREEN.and(AnsiFont.BOLD), "< 脚本上传成功 ") .append(AnsiForeground.GREEN.and(AnsiFont.BOLD), "< 脚本上传成功 ")
.append(Dates.current()) .append(Dates.current())
.newLine() .newLine()
.newLine() .newLine()
.append(AnsiForeground.BRIGHT_GREEN.and(AnsiFont.BOLD), "> 开始执行脚本 ") .append(AnsiForeground.GREEN.and(AnsiFont.BOLD), "> 开始执行脚本 ")
.append(Dates.current()) .append(Dates.current())
.newLine(); .newLine();
this.appendLog(finishAppender); this.appendLog(finishAppender);
} catch (Exception e) { } catch (Exception e) {
// 拼接失败日志 // 拼接失败日志
AnsiAppender errorAppender = AnsiAppender.create() AnsiAppender errorAppender = AnsiAppender.create()
.append(AnsiForeground.BRIGHT_RED.and(AnsiFont.BOLD), "< 脚本上传失败 ") .append(AnsiForeground.RED.and(AnsiFont.BOLD), "< 脚本上传失败 ")
.append(Dates.current()) .append(Dates.current())
.newLine(); .newLine();
this.appendLog(errorAppender); this.appendLog(errorAppender);
@@ -133,37 +133,37 @@ public class ExecCommandAnsiHandler extends BaseExecCommandHandler {
.newLine(); .newLine();
if (this.status == ExecHostStatusEnum.INTERRUPTED) { if (this.status == ExecHostStatusEnum.INTERRUPTED) {
// 中断执行 // 中断执行
appender.append(AnsiForeground.BRIGHT_YELLOW.and(AnsiFont.BOLD), "< 命令执行中断 ") appender.append(AnsiForeground.YELLOW.and(AnsiFont.BOLD), "< 命令执行中断 ")
.append(Dates.current()) .append(Dates.current())
.newLine(); .newLine();
} else if (this.status == ExecHostStatusEnum.FAILED) { } else if (this.status == ExecHostStatusEnum.FAILED) {
// 执行失败 // 执行失败
appender.append(AnsiForeground.BRIGHT_RED.and(AnsiFont.BOLD), "< 命令执行失败 ") appender.append(AnsiForeground.RED.and(AnsiFont.BOLD), "< 命令执行失败 ")
.append(Dates.current()) .append(Dates.current())
.newLine() .newLine()
.append(AnsiForeground.BRIGHT_RED.and(AnsiFont.BOLD), "错误原因: ") .append(AnsiForeground.RED.and(AnsiFont.BOLD), "错误原因: ")
.append(this.getErrorMessage(e)) .append(this.getErrorMessage(e))
.newLine(); .newLine();
} else if (this.status == ExecHostStatusEnum.TIMEOUT) { } else if (this.status == ExecHostStatusEnum.TIMEOUT) {
// 更新执行超时 // 更新执行超时
appender.append(AnsiForeground.BRIGHT_YELLOW.and(AnsiFont.BOLD), "< 命令执行超时 ") appender.append(AnsiForeground.YELLOW.and(AnsiFont.BOLD), "< 命令执行超时 ")
.append(Dates.current()) .append(Dates.current())
.newLine(); .newLine();
} else { } else {
long ms = this.updateRecord.getFinishTime().getTime() - this.updateRecord.getStartTime().getTime(); long ms = this.updateRecord.getFinishTime().getTime() - this.updateRecord.getStartTime().getTime();
Integer exitStatus = this.updateRecord.getExitStatus(); Integer exitStatus = this.updateRecord.getExitStatus();
// 执行完成 // 执行完成
appender.append(AnsiForeground.BRIGHT_GREEN.and(AnsiFont.BOLD), "< 命令执行完成 ") appender.append(AnsiForeground.GREEN.and(AnsiFont.BOLD), "< 命令执行完成 ")
.append(Dates.current()) .append(Dates.current())
.newLine() .newLine()
.append(AnsiForeground.BRIGHT_BLUE.and(AnsiFont.BOLD), "exit: "); .append(AnsiForeground.BLUE.and(AnsiFont.BOLD), "exit: ");
if (ExitCode.isSuccess(exitStatus)) { if (ExitCode.isSuccess(exitStatus)) {
appender.append(AnsiForeground.BRIGHT_GREEN.and(AnsiFont.BOLD), exitStatus); appender.append(AnsiForeground.GREEN.and(AnsiFont.BOLD), exitStatus);
} else { } else {
appender.append(AnsiForeground.BRIGHT_RED.and(AnsiFont.BOLD), exitStatus); appender.append(AnsiForeground.RED.and(AnsiFont.BOLD), exitStatus);
} }
appender.newLine() appender.newLine()
.append(AnsiForeground.BRIGHT_BLUE.and(AnsiFont.BOLD), "used: ") .append(AnsiForeground.BLUE.and(AnsiFont.BOLD), "used: ")
.append(Dates.interval(ms, false, "d ", "h ", "m ", "s")) .append(Dates.interval(ms, false, "d ", "h ", "m ", "s"))
.append(" (") .append(" (")
.append(ms) .append(ms)

View File

@@ -113,7 +113,7 @@ public class HostConnectLogServiceImpl implements HostConnectLogService {
@Override @Override
public Integer updateStatusById(Long id, HostConnectStatusEnum status, Map<String, Object> partial) { public Integer updateStatusById(Long id, HostConnectStatusEnum status, Map<String, Object> partial) {
log.info("HostConnectLogService-updateStatusByToken start id: {}, status: {}", id, status); log.info("HostConnectLogService-updateStatusById start id: {}, status: {}", id, status);
// 查询 // 查询
HostConnectLogDO record = hostConnectLogDAO.of() HostConnectLogDO record = hostConnectLogDAO.of()
.createWrapper() .createWrapper()
@@ -122,7 +122,7 @@ public class HostConnectLogServiceImpl implements HostConnectLogService {
.then() .then()
.getOne(); .getOne();
if (record == null) { if (record == null) {
log.info("HostConnectLogService-updateStatusByToken no record id: {}", id); log.info("HostConnectLogService-updateStatusById no record id: {}", id);
return Const.N_0; return Const.N_0;
} }
return this.updateStatus(record, status, partial); return this.updateStatus(record, status, partial);

View File

@@ -63,7 +63,7 @@
"name": "app.exec-log.keep-period", "name": "app.exec-log.keep-period",
"type": "java.lang.Integer", "type": "java.lang.Integer",
"description": "保留周期 (天)", "description": "保留周期 (天)",
"defaultValue": "60" "defaultValue": "30"
} }
] ]
} }

5
pull.sh Normal file
View File

@@ -0,0 +1,5 @@
#/bin/bash
git clean -df
git reset --hard HEAD
git pull
git log -n 1