From d98501fe66a4e6fa1d14bdc0d5ec6e9d5c10674a Mon Sep 17 00:00:00 2001 From: juewuy Date: Sun, 25 Jan 2026 20:43:34 +0800 Subject: [PATCH] =?UTF-8?q?~=E5=A2=9E=E5=8A=A0=E6=97=A5=E5=BF=97=E5=AE=B9?= =?UTF-8?q?=E9=87=8F=EF=BC=8C=E5=8F=96=E6=B6=8860=E5=88=86=E9=92=9F?= =?UTF-8?q?=E4=BB=A5=E5=86=85=E5=AE=9A=E6=97=B6=E4=BB=BB=E5=8A=A1=E7=9A=84?= =?UTF-8?q?=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 | 12 ++++++------ scripts/menus/task_cmd.sh | 3 +-- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/scripts/libs/logger.sh b/scripts/libs/logger.sh index 5d168ecb..60b29b2b 100644 --- a/scripts/libs/logger.sh +++ b/scripts/libs/logger.sh @@ -3,10 +3,10 @@ #$1日志内容$2显示颜色$3是否推送 logger() { TMPDIR=/tmp/ShellCrash - [ -n "$2" -a "$2" != 0 ] && echo -e "\033[$2m$1\033[0m" + [ -n "$2" -a "$2" != 0 ] && printf "\033[%sm%s\033[0m\n" "$2" "$1" log_text="$(date "+%G-%m-%d_%H:%M:%S")~$1" echo "$log_text" >>"$TMPDIR"/ShellCrash.log - [ "$(wc -l "$TMPDIR"/ShellCrash.log | awk '{print $1}')" -gt 99 ] && sed -i '1,50d' "$TMPDIR"/ShellCrash.log + [ "$(wc -l "$TMPDIR"/ShellCrash.log | awk '{print $1}')" -gt 199 ] && sed -i '1,20d' "$TMPDIR"/ShellCrash.log #推送远程日志 [ -z "$3" ] && { [ -n "$device_name" ] && log_text="$log_text($device_name)" @@ -18,7 +18,7 @@ logger() { } [ -n "$push_bark" ] && { url="${push_bark}" - content="{\"body\":\"${log_text}\",\"title\":\"ShellCrash日志推送\",\"level\":\"passive\",\"badge\":\"1\"}" + content="{\"body\":\"${log_text}\",\"title\":\"ShellCrash_log\",\"level\":\"passive\",\"badge\":\"1\"}" web_json_post "$url" "$content" & } [ -n "$push_Deer" ] && { @@ -28,17 +28,17 @@ logger() { } [ -n "$push_Po" ] && { url="https://api.pushover.net/1/messages.json" - content="{\"token\":\"${push_Po}\",\"user\":\"${push_Po_key}\",\"title\":\"ShellCrash日志推送\",\"message\":\"$log_text\"}" + content="{\"token\":\"${push_Po}\",\"user\":\"${push_Po_key}\",\"title\":\"ShellCrash_log\",\"message\":\"$log_text\"}" web_json_post "$url" "$content" & } [ -n "$push_PP" ] && { url="http://www.pushplus.plus/send" - content="{\"token\":\"${push_PP}\",\"title\":\"ShellCrash日志推送\",\"content\":\"$log_text\"}" + content="{\"token\":\"${push_PP}\",\"title\":\"ShellCrash_log\",\"content\":\"$log_text\"}" web_json_post "$url" "$content" & } [ -n "$push_Gotify" ] && { url="${push_Gotify}" - content="{\"title\":\"ShellCrash日志推送\",\"message\":\"$log_text\",\"priority\":5}" + content="{\"title\":\"ShellCrash_log\",\"message\":\"$log_text\",\"priority\":5}" web_json_post "$url" "$content" & } [ -n "$push_SynoChat" ] && { diff --git a/scripts/menus/task_cmd.sh b/scripts/menus/task_cmd.sh index 5f3094e1..5913f0fd 100644 --- a/scripts/menus/task_cmd.sh +++ b/scripts/menus/task_cmd.sh @@ -14,8 +14,7 @@ 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])分钟' && push=off - logger "$1" 0 "$push" + echo "$1" |grep -qE '(每隔|时每)([1-9]|[1-9][0-9])分钟' || logger "$1" 0 "$push" } #任务命令