← back to Goldleafwallpaper
scripts/refresh-metalleaf-fleet.sh
21 lines
#!/usr/bin/env bash
# refresh-metalleaf-fleet.sh — nightly refresh of BOTH metal-leaf microsites
# (goldleafwallpaper.com + silverleafwallpaper.com) from the local dw_unified
# mirror. Each site's rebuild-and-deploy.sh rebuilds data/products.json from the
# ACTIVE RML- line, rsyncs it, restarts pm2, and verifies the live count.
#
# Scheduled by launchd com.steve.metalleaf-rml-refresh (daily 07:00 — after the
# 06:00 dw-shopify-products-sync populates the mirror). One site failing does not
# abort the other; the exit code is non-zero if EITHER fails, so launchd logs it.
set -u
GOLD="$HOME/Projects/goldleafwallpaper/scripts/rebuild-and-deploy.sh"
SILVER="$HOME/Projects/silverleafwallpaper/scripts/rebuild-and-deploy.sh"
rc=0
echo "===== metal-leaf RML refresh $(date '+%F %T') ====="
bash "$GOLD" || { echo "GOLD refresh FAILED"; rc=1; }
bash "$SILVER" || { echo "SILVER refresh FAILED"; rc=1; }
echo "===== done (rc=$rc) ====="
exit $rc