From d96b6e769ac590a1110f66cd0d7db38e2af4ccb3 Mon Sep 17 00:00:00 2001 From: hotyue <52734432+hotyue@users.noreply.github.com> Date: Fri, 17 Apr 2026 05:31:58 +0000 Subject: [PATCH] =?UTF-8?q?fix(core):=20=E5=BC=95=E5=85=A5=20flock=20?= =?UTF-8?q?=E6=8E=92=E4=BB=96=E9=94=81=EF=BC=8C=E5=BD=BB=E5=BA=95=E8=A7=A3?= =?UTF-8?q?=E5=86=B3=20Cron=20=E4=BB=BB=E5=8A=A1=E9=87=8D=E5=85=A5?= =?UTF-8?q?=E5=AF=BC=E8=87=B4=E7=9A=84=E5=86=85=E5=AD=98=E9=9B=AA=E5=B4=A9?= =?UTF-8?q?=E4=B8=8E=20Fork=20=E7=82=B8=E5=BC=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/runner.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/core/runner.sh b/core/runner.sh index a1c7e17..10db3cc 100755 --- a/core/runner.sh +++ b/core/runner.sh @@ -15,6 +15,14 @@ if [ ! -f "$CONFIG_FILE" ]; then fi source "$CONFIG_FILE" +# ================== [新增: 文件排他锁,防止并发重入引发内存雪崩] ================== +exec 200>"/tmp/ip_sentinel_runner.lock" +if ! flock -n 200; then + echo "[$(date)] ⚠️ 上一轮巡逻任务尚未结束,本次触发自动取消。" >> "$LOG_FILE" + exit 0 +fi +# ================================================================================== + # 2. 全局日志写入函数 (导出给子进程共享使用,v3.4.0 引入版本探针) log() { local module=$1