[object Object]

← back to Marketing Command Center

refresh-clients.sh: mkdir lock (macOS has no flock)

b50489a9355e2e730374c463d6ccb80d1a892d9b · 2026-07-16 11:00:16 -0700 · steve

Files touched

Diff

commit b50489a9355e2e730374c463d6ccb80d1a892d9b
Author: steve <steve@designerwallcoverings.com>
Date:   Thu Jul 16 11:00:16 2026 -0700

    refresh-clients.sh: mkdir lock (macOS has no flock)
---
 scripts/refresh-clients.sh | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/scripts/refresh-clients.sh b/scripts/refresh-clients.sh
index c2d2bd2..be7cbf6 100755
--- a/scripts/refresh-clients.sh
+++ b/scripts/refresh-clients.sh
@@ -11,12 +11,13 @@ set -uo pipefail
 export PATH="/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:$PATH"
 PROJ="$HOME/Projects/marketing-command-center"
 LOG=/tmp/mcc-clients-refresh.log
-LOCK=/tmp/mcc-clients-refresh.lock
+LOCKDIR=/tmp/mcc-clients-refresh.lockd
 DL="$HOME/Downloads"
 exec >>"$LOG" 2>&1
 
-# single instance
-exec 9>"$LOCK"; flock -n 9 || { echo "$(date '+%F %T') already running — skip"; exit 0; }
+# single instance — mkdir is atomic + portable (macOS has no flock)
+if ! mkdir "$LOCKDIR" 2>/dev/null; then echo "$(date '+%F %T') already running — skip"; exit 0; fi
+trap 'rmdir "$LOCKDIR" 2>/dev/null' EXIT
 echo "===== $(date '+%F %T') mcc-clients-refresh START ====="
 cd "$PROJ" || exit 1
 

← 09230f0 refresh-clients.sh: pin PATH for launchd (node/python/homebr  ·  back to Marketing Command Center  ·  clients panel: per-group CSV export (respects filter; includ c1ee3c8 →