← back to Commercialrealestate

scripts/crexi-accrual-cron.sh

17 lines

#!/bin/zsh
# crexi-accrual-cron.sh — TK-10709 paced Crexi accrual/refresh wrapper.
# NOT scheduled/installed. The launchd job that would call this is GATED and NOT approved — this
# script only exists so that, IF Steve approves the schedule, install is a one-step paste.
# Runs one paced, throttle-respecting batch across all CRE types. The scraper dedups by normalized
# address across ALL sources, so re-runs only ADD genuinely-new listings (freshness) — never dupes.
# $0 (openclaw local Chrome). Reversible: DELETE FROM broker_direct_listing WHERE source='crexi'.
set -u
PROJ="/Users/macstudio3/Projects/commercialrealestate"
NODE="/opt/homebrew/bin/node"
LOG="$PROJ/data/crexi-accrual-cron.log"
cd "$PROJ" || exit 1
echo "=== $(date -u +%Y-%m-%dT%H:%M:%SZ) crexi accrual run ===" >> "$LOG"
# refresh the grid queue occasionally by letting the 24h TTL lapse; --type=all, modest paced budget.
"$NODE" scripts/scrape-crexi-loopnet.js --type=all --pages=40 --limit=2000 --minutes=20 --apply >> "$LOG" 2>&1
echo "--- done $(date -u +%Y-%m-%dT%H:%M:%SZ) ---" >> "$LOG"