From 59f7b72bb198219f18dec794a4ae3e2173ca04f0 Mon Sep 17 00:00:00 2001 From: whyour Date: Thu, 23 Nov 2023 19:40:52 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E9=99=A4=20ql=20-l=20=E5=8F=82?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- back/services/system.ts | 5 +++-- docker/docker-entrypoint.sh | 4 ++-- shell/update.sh | 15 ++++----------- src/locales/en-US.json | 2 +- src/locales/zh-CN.json | 2 +- src/pages/error/index.tsx | 2 +- 6 files changed, 12 insertions(+), 18 deletions(-) diff --git a/back/services/system.ts b/back/services/system.ts index ad26a249..f1cb831f 100644 --- a/back/services/system.ts +++ b/back/services/system.ts @@ -159,7 +159,7 @@ export default class SystemService { } public async updateSystem() { - const cp = spawn('ql -l update false', { shell: '/bin/bash' }); + const cp = spawn('no_tee=true ql update false', { shell: '/bin/bash' }); cp.stdout.on('data', (data) => { this.sockService.sendMessage({ @@ -186,7 +186,8 @@ export default class SystemService { } public async reloadSystem(target: 'system' | 'data') { - const cp = spawn(`ql -l reload ${target || ''}`, { shell: '/bin/bash' }); + const cmd = `no_tee=true ql reload ${target || ''}`; + const cp = spawn(cmd, { shell: '/bin/bash' }); cp.stdout.on('data', (data) => { this.sockService.sendMessage({ diff --git a/docker/docker-entrypoint.sh b/docker/docker-entrypoint.sh index c81b7d67..a783b0fe 100755 --- a/docker/docker-entrypoint.sh +++ b/docker/docker-entrypoint.sh @@ -39,13 +39,13 @@ reload_pm2 if [[ $AutoStartBot == true ]]; then echo -e "======================5. 启动bot========================\n" - nohup ql -l bot >$dir_log/bot.log 2>&1 & + nohup ql bot >$dir_log/bot.log 2>&1 & echo -e "bot后台启动中...\n" fi if [[ $EnableExtraShell == true ]]; then echo -e "====================6. 执行自定义脚本========================\n" - nohup ql -l extra >$dir_log/extra.log 2>&1 & + nohup ql extra >$dir_log/extra.log 2>&1 & echo -e "自定义脚本后台执行中...\n" fi diff --git a/shell/update.sh b/shell/update.sh index 3cf21f91..95f9f0f0 100755 --- a/shell/update.sh +++ b/shell/update.sh @@ -476,8 +476,10 @@ main() { local log_path="${log_dir}/${log_time}.log" local file_path="$dir_log/$log_path" - cmd=">> $file_path 2>&1" - [[ "$show_log" == "true" ]] && cmd="" + cmd="2>&1 | tee -a $file_path" + if [[ "$no_tee" == "true" ]]; then + cmd=">> $file_path 2>&1" + fi local time_format="%Y-%m-%d %H:%M:%S" local time=$(date "+$time_format") @@ -490,11 +492,6 @@ main() { eval echo -e "\#\# 开始执行... $begin_time\\\n" $cmd fi - if [[ "$show_log" == "true" ]] && [[ $ID ]]; then - eval echo -e "请移除 -l 参数" $cmd - exit 1 - fi - case $p1 in update) fix_config @@ -559,10 +556,6 @@ main() { if [[ "$p1" != "repo" ]] && [[ "$p1" != "raw" ]]; then eval echo -e "\\\n\#\# 执行结束... $end_time 耗时 $diff_time 秒     " $cmd fi - - if [[ -f $file_path ]]; then - cat $file_path - fi } main "$@" diff --git a/src/locales/en-US.json b/src/locales/en-US.json index 4a4670fa..e3f627ee 100644 --- a/src/locales/en-US.json +++ b/src/locales/en-US.json @@ -141,7 +141,7 @@ "服务启动超时": "Service startup timeout", "请先按如下方式修复:": "Please fix it as follows:", "1. 宿主机执行 docker run --rm -v\n /var/run/docker.sock:/var/run/docker.sock\n containrrr/watchtower -cR <容器名>": "1. Execute 'docker run --rm -v /var/run/docker.sock:/var/run/docker.sock containrrr/watchtower -cR ' on the host machine", - "2. 容器内执行 ql -l check、ql -l update": "2. Execute 'ql -l check' and 'ql -l update' inside the container", + "2. 容器内执行 ql check、ql update": "2. Execute 'ql check' and 'ql update' inside the container", "3. 如果无法解决,容器内执行 pm2 logs,拷贝执行结果": "3. If the problem persists, execute 'pm2 logs' inside the container and copy the results", "提交 issue": "Submit an issue", "启动中,请稍后...": "Starting, please wait...", diff --git a/src/locales/zh-CN.json b/src/locales/zh-CN.json index cf7613db..53f31bcc 100644 --- a/src/locales/zh-CN.json +++ b/src/locales/zh-CN.json @@ -141,7 +141,7 @@ "服务启动超时": "服务启动超时", "请先按如下方式修复:": "请先按如下方式修复:", "1. 宿主机执行 docker run --rm -v\n /var/run/docker.sock:/var/run/docker.sock\n containrrr/watchtower -cR <容器名>": "1. 宿主机执行 docker run --rm -v\n /var/run/docker.sock:/var/run/docker.sock\n containrrr/watchtower -cR <容器名>", - "2. 容器内执行 ql -l check、ql -l update": "2. 容器内执行 ql -l check、ql -l update", + "2. 容器内执行 ql check、ql update": "2. 容器内执行 ql check、ql update", "3. 如果无法解决,容器内执行 pm2 logs,拷贝执行结果": "3. 如果无法解决,容器内执行 pm2 logs,拷贝执行结果", "提交 issue": "提交 issue", "启动中,请稍后...": "启动中,请稍后...", diff --git a/src/pages/error/index.tsx b/src/pages/error/index.tsx index 30a5cc88..430a8c53 100644 --- a/src/pages/error/index.tsx +++ b/src/pages/error/index.tsx @@ -71,7 +71,7 @@ const Error = () => { /var/run/docker.sock:/var/run/docker.sock containrrr/watchtower -cR <容器名> -
{intl.get('2. 容器内执行 ql -l check、ql -l update')}
+
{intl.get('2. 容器内执行 ql check、ql update')}
{intl.get( '3. 如果无法解决,容器内执行 pm2 logs,拷贝执行结果'