← back to La Socrata Ingester
Add self-rotating refresh wrapper (bounds tmp/ingest.log to ~10MB, no extra cron job); point refresh plist at it — swap is gated
5ef077c2c84b591b166eff9d5cdc803d7caa6c1a · 2026-08-12 09:19:48 -0700 · Steve Abrams
Files touched
M scripts/launchd/com.steve.la-data-refresh.plistA scripts/run-refresh.sh
Diff
commit 5ef077c2c84b591b166eff9d5cdc803d7caa6c1a
Author: Steve Abrams <steve@designerwallcoverings.com>
Date: Wed Aug 12 09:19:48 2026 -0700
Add self-rotating refresh wrapper (bounds tmp/ingest.log to ~10MB, no extra cron job); point refresh plist at it — swap is gated
---
scripts/launchd/com.steve.la-data-refresh.plist | 9 ++++-----
scripts/run-refresh.sh | 22 ++++++++++++++++++++++
2 files changed, 26 insertions(+), 5 deletions(-)
diff --git a/scripts/launchd/com.steve.la-data-refresh.plist b/scripts/launchd/com.steve.la-data-refresh.plist
index fc0e13e..a526451 100644
--- a/scripts/launchd/com.steve.la-data-refresh.plist
+++ b/scripts/launchd/com.steve.la-data-refresh.plist
@@ -6,9 +6,8 @@
<string>com.steve.la-data-refresh</string>
<key>ProgramArguments</key>
<array>
- <string>/opt/homebrew/bin/node</string>
- <string>/Users/macstudio3/Projects/la-socrata-ingester/src/cli.js</string>
- <string>all</string>
+ <string>/bin/bash</string>
+ <string>/Users/macstudio3/Projects/la-socrata-ingester/scripts/run-refresh.sh</string>
</array>
<key>WorkingDirectory</key>
<string>/Users/macstudio3/Projects/la-socrata-ingester</string>
@@ -22,9 +21,9 @@
<key>RunAtLoad</key>
<false/>
<key>StandardOutPath</key>
- <string>/Users/macstudio3/Projects/la-socrata-ingester/tmp/ingest.log</string>
+ <string>/Users/macstudio3/Projects/la-socrata-ingester/tmp/refresh.wrap.log</string>
<key>StandardErrorPath</key>
- <string>/Users/macstudio3/Projects/la-socrata-ingester/tmp/ingest.err.log</string>
+ <string>/Users/macstudio3/Projects/la-socrata-ingester/tmp/refresh.wrap.log</string>
<key>EnvironmentVariables</key>
<dict>
<key>PATH</key>
diff --git a/scripts/run-refresh.sh b/scripts/run-refresh.sh
new file mode 100755
index 0000000..f9e0cfd
--- /dev/null
+++ b/scripts/run-refresh.sh
@@ -0,0 +1,22 @@
+#!/bin/bash
+# run-refresh.sh — daily LA Socrata/ArcGIS incremental refresh with a self-rotating log.
+# Keeps tmp/ingest.log bounded on a disk-tight box WITHOUT a separate scheduled job:
+# each run rotates the log if it exceeds MAXBYTES (one .1 backup kept), then appends.
+# Passes through any extra args to cli.js (so `run-refresh.sh --max=1` = a bounded smoke).
+# $0 local — free public APIs.
+set -euo pipefail
+cd "$(dirname "$0")/.." # project root
+
+NODE=/opt/homebrew/bin/node
+LOG="tmp/ingest.log"
+MAXBYTES=$((5 * 1024 * 1024)) # 5 MB → rotate; max on-disk footprint ≈ 10 MB (log + .1)
+mkdir -p tmp
+
+# rotate BEFORE opening the append fd (so the size check is honest)
+if [ -f "$LOG" ] && [ "$(stat -f%z "$LOG")" -gt "$MAXBYTES" ]; then
+ mv -f "$LOG" "$LOG.1"
+fi
+
+echo "=== [$(date '+%Y-%m-%d %H:%M:%S')] refresh cycle start ===" >> "$LOG"
+"$NODE" src/cli.js all "$@" >> "$LOG" 2>&1
+echo "=== [$(date '+%Y-%m-%d %H:%M:%S')] refresh cycle done (\$0) ===" >> "$LOG"
← 707ec14 viewer: swap live ranking to permit_lead_score_v2 (0/1.58M p
·
back to La Socrata Ingester
·
Archive la-permits-live-refresh plist for one-copy rollback cc6b19f →