From 9cad2c21e82eb78d8927f1609b52483fb8f2e33e Mon Sep 17 00:00:00 2001 From: juewuy Date: Mon, 2 Feb 2026 20:04:53 +0800 Subject: [PATCH] =?UTF-8?q?~=E4=BC=98=E5=8C=96=E5=AE=9A=E6=97=B6=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=E6=97=A5=E5=BF=97=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/libs/logger.sh | 5 +++-- scripts/menus/task_cmd.sh | 6 +++++- scripts/starts/core_config.sh | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/scripts/libs/logger.sh b/scripts/libs/logger.sh index 60b29b2b..cb832b6e 100644 --- a/scripts/libs/logger.sh +++ b/scripts/libs/logger.sh @@ -1,14 +1,15 @@ #日志工具 . "$CRASHDIR"/libs/web_json.sh -#$1日志内容$2显示颜色$3是否推送 +#$1日志内容$2显示颜色$3是否推送$4是否覆盖上一条 logger() { TMPDIR=/tmp/ShellCrash [ -n "$2" -a "$2" != 0 ] && printf "\033[%sm%s\033[0m\n" "$2" "$1" log_text="$(date "+%G-%m-%d_%H:%M:%S")~$1" + [ "$4" = on ] && sed -i "/$1/d" "$TMPDIR"/ShellCrash.log echo "$log_text" >>"$TMPDIR"/ShellCrash.log [ "$(wc -l "$TMPDIR"/ShellCrash.log | awk '{print $1}')" -gt 199 ] && sed -i '1,20d' "$TMPDIR"/ShellCrash.log #推送远程日志 - [ -z "$3" ] && { + [ "$3" != off ] && { [ -n "$device_name" ] && log_text="$log_text($device_name)" [ -n "$push_TG" ] && { url="https://api.telegram.org/bot${push_TG}/sendMessage" diff --git a/scripts/menus/task_cmd.sh b/scripts/menus/task_cmd.sh index 5913f0fd..d6ea0e6e 100644 --- a/scripts/menus/task_cmd.sh +++ b/scripts/menus/task_cmd.sh @@ -14,7 +14,11 @@ task_logger(){ [ "$task_push" = 1 ] && push= || push=off [ -n "$2" -a "$2" != 0 ] && echo -e "\033[$2m$1\033[0m" [ "$3" = 'off' ] && push=off - echo "$1" |grep -qE '(每隔|时每)([1-9]|[1-9][0-9])分钟' || logger "$1" 0 "$push" + echo "$1" |grep -qE '(每隔|时每)([1-9]|[1-9][0-9])分钟' && { + push=off + cover=on + } + logger "$1" 0 "$push" "$cover" } #任务命令 diff --git a/scripts/starts/core_config.sh b/scripts/starts/core_config.sh index de1bd553..6ab1cdbd 100644 --- a/scripts/starts/core_config.sh +++ b/scripts/starts/core_config.sh @@ -65,7 +65,7 @@ get_core_config() { #下载内核配置文件 exit 1 else retry=$((retry + 1)) - logger "配置文件获取失败!" 31 + logger "配置文件获取失败!" 31 off on if [ "$retry" = 1 ]; then echo -e "\033[32m尝试更新服务器列表并使用其他服务器获取配置!\033[0m" update_servers