From e6874c98d2ec6f4d1ab3f700bbf2fda7ef2018a4 Mon Sep 17 00:00:00 2001 From: mack-a <57424792+mack-a@users.noreply.github.com> Date: Sun, 18 Apr 2021 14:37:04 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E8=84=9A=E6=9C=AC):=20=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E6=9F=A5=E7=9C=8B=E6=97=A5=E5=BF=97=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- install.sh | 41 +++++++++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 16 deletions(-) diff --git a/install.sh b/install.sh index c555664..71bb884 100644 --- a/install.sh +++ b/install.sh @@ -2681,14 +2681,24 @@ checkLog() { if [[ -z ${configPath} ]]; then echoContent red " ---> 没有检测到安装目录,请执行脚本安装内容" fi + local logStatus=false + if [[ -n $(cat ${configPath}00_log.json|grep access) ]];then + logStatus=true + fi + echoContent skyBlue "\n功能 $1/${totalProgress} : 查看日志" echoContent red "\n==============================================================" echoContent yellow "# 建议仅调试打开access日志\n" - echoContent yellow "1.打开access日志" - echoContent yellow "2.关闭access日志" - echoContent yellow "3.监听access日志" - echoContent yellow "4.监听error日志" - echoContent yellow "5.清空日志" + + if [[ "${logStatus}" == "false" ]];then + echoContent yellow "1.打开access日志" + else + echoContent yellow "1.关闭access日志" + fi + + echoContent yellow "2.监听access日志" + echoContent yellow "3.监听error日志" + echoContent yellow "4.清空日志" echoContent red "==============================================================" read -r -p "请选择:" selectAccessLogType @@ -2696,7 +2706,8 @@ checkLog() { case ${selectAccessLogType} in 1) - cat <${configPath}00_log.json + if [[ "${logStatus}" == "false" ]];then + cat <${configPath}00_log.json { "log": { "access":"${configPathLog}access.log", @@ -2704,13 +2715,9 @@ checkLog() { "loglevel": "warning" } } - EOF - reloadCore - checkLog 1 - ;; - 2) - cat <${configPath}00_log.json + elif [[ "${logStatus}" == "true" ]];then + cat <${configPath}00_log.json { "log": { "error": "${configPathLog}error.log", @@ -2718,15 +2725,17 @@ EOF } } EOF + fi reloadCore + checkLog 1 ;; - 3) + 2) tail -f ${configPathLog}access.log ;; - 4) + 3) tail -f ${configPathLog}error.log ;; - 5) + 4) echo >${configPathLog}access.log echo >${configPathLog}error.log ;; @@ -3602,7 +3611,7 @@ menu() { cd "$HOME" || exit echoContent red "\n==============================================================" echoContent green "作者:mack-a" - echoContent green "当前版本:v2.4.14" + echoContent green "当前版本:v2.4.15" echoContent green "Github:https://github.com/mack-a/v2ray-agent" echoContent green "描述:七合一共存脚本\c" showInstallStatus