From 3ab751ed1408c53d6958246ae4c5225f99722d4a Mon Sep 17 00:00:00 2001 From: Yule Date: Fri, 10 Apr 2026 10:48:42 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=B0=9D=E8=AF=95=E7=BB=99=20`up.sh`=20?= =?UTF-8?q?=E5=8A=A0=E9=94=81=E4=BF=AE=E5=A4=8D=20`r`=20`a`=20`0`=20?= =?UTF-8?q?=E4=BA=8B=E4=BB=B6=E7=9A=84=E5=BE=AA=E7=8E=AF=E8=A7=A6=E5=8F=91?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- script/up.sh | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/script/up.sh b/script/up.sh index 7bb91e9..6b7d7bf 100644 --- a/script/up.sh +++ b/script/up.sh @@ -50,13 +50,20 @@ _log() { printf '[%s] [%s] [%s] %s\n' "$(date '+%m-%d %H:%M:%S')" "up" "$level" "$1" >>"$log_file" } -_log "收到亮度变更通知 (PID: $$)" "INFO" - if [ -f "$stop_file" ]; then _log "服务已暂停,跳过本次处理" "WARN" exit 0 fi +# 防止 up.sh 自身读写亮度节点时触发 inotify 事件导致递归调用 +lock_file="$PID_DIR/up.lock" +if [ -e "$lock_file" ]; then + exit 0 +fi +echo $$ >"$lock_file" +# shellcheck disable=SC2064 +trap "rm -f '$lock_file'" EXIT HUP INT TERM + # 读取配置 ui_max_bri="$(get_cfg ui_max_bri 0)" max_bri="$(get_cfg max_bri 0)" @@ -119,7 +126,6 @@ CHECK_BRI() { fi sleep 0.3 done - _log "检测超时: 亮度未持续达到提升阈値" "INFO" return 1 } @@ -188,7 +194,6 @@ MAIN() { fi fi - _log "正在检测亮度变化..." "INFO" CHECK_BRI }