← back to Stayclaim

scripts/pd-film-images-refresh.sh

23 lines

#!/bin/bash
# Nightly refresh of public-domain film/TV images on Kamatera pastdoor.
# Runs from Mac Studio 2 launchd → SSHs into Kamatera → runs the fetcher
# inside the pastdoor cwd so .env.production is picked up automatically.
#
# Per Steve's "no cloud agents" rule (memory: feedback_no_cloud_agents.md),
# the schedule lives on the Mac, not on Kamatera.

set -euo pipefail

LOG=/Users/macstudio3/Library/Logs/pd-film-images-refresh.log
ts() { date +'%Y-%m-%d %H:%M:%S'; }

echo "[$(ts)] starting pd-film-images refresh" >> "$LOG"

ssh -o ConnectTimeout=15 -o BatchMode=yes root@45.61.58.125 \
  'cd /root/public-projects/pastdoor && set -a && source .env.production && set +a && timeout 180 node scripts/fetch-pd-film-images.mjs --limit=400' \
  >> "$LOG" 2>&1

rc=$?
echo "[$(ts)] finished rc=$rc" >> "$LOG"
exit $rc