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