mirror of
https://github.com/YuleBest/LuminPro.git
synced 2026-12-04 00:54:42 +08:00
fix: 增加自愈锁,修复 up.lock 僵尸锁问题
This commit is contained in:
1 parent
3ab751ed14
commit
b7e792c126
4 files changed
+131
-4
No files matched your search
@@ -23,6 +23,7 @@ touch "$pause_file"
|
||||
# 2. 清理遗留标记
|
||||
rm -f "$pid_file"
|
||||
rm -f "$flag_file"
|
||||
rm -f "$PID_DIR/up.lock"
|
||||
_log "已清理锁文件"
|
||||
|
||||
# 3. 恢复守护进程 (它会自动拉起新 inotifyd)
|
||||
|
||||
+8
-3
@@ -1,4 +1,4 @@
|
||||
#!/system/bin/sh
|
||||
#!/system/bin/sh
|
||||
#shellcheck shell=ash
|
||||
# 亮度提升脚本
|
||||
|
||||
@@ -57,8 +57,13 @@ fi
|
||||
|
||||
# 防止 up.sh 自身读写亮度节点时触发 inotify 事件导致递归调用
|
||||
lock_file="$PID_DIR/up.lock"
|
||||
if [ -e "$lock_file" ]; then
|
||||
exit 0
|
||||
if [ -f "$lock_file" ]; then
|
||||
old_pid=$(cat "$lock_file" 2>/dev/null)
|
||||
if [ -n "$old_pid" ] && [ -d "/proc/$old_pid" ]; then
|
||||
exit 0
|
||||
fi
|
||||
# PID 不存在,说明是遗留的锁,清理之
|
||||
rm -f "$lock_file"
|
||||
fi
|
||||
echo $$ >"$lock_file"
|
||||
# shellcheck disable=SC2064
|
||||
|
||||
Reference in new issue
Block a user