From e0116db244d4e367eccb9bb26a9a8dba43b56fd0 Mon Sep 17 00:00:00 2001 From: cfdaily Date: Thu, 28 May 2026 13:15:30 +0800 Subject: [PATCH] auto-sync: 2026-05-28 13:15:30 --- scripts/gateway-watchdog.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/gateway-watchdog.sh b/scripts/gateway-watchdog.sh index 30200c7..83d4f5e 100755 --- a/scripts/gateway-watchdog.sh +++ b/scripts/gateway-watchdog.sh @@ -16,10 +16,11 @@ export PATH="/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin:$PATH" # === flock 防并发 === LOCK_FILE="/tmp/gateway-watchdog.lock" -exec 9>"$LOCK_FILE" -if ! flock -n 9; then +# macOS 无 flock,用 mkdir 做简易锁 +if ! mkdir "$LOCK_FILE" 2>/dev/null; then exit 0 fi +trap 'rmdir "$LOCK_FILE" 2>/dev/null' EXIT # === 配置 === CHECK_WINDOW=120 # 检查最近多少秒的日志