← back to Wolfgordon Crawl
daily-push.sh
35 lines
#!/usr/bin/env bash
# ============================================================================
# Wolf Gordon Phase-2 daily new-product driver (resumable, idempotent-by-SKU).
#
# Creates up to MAX net-new WG products/day (each = 2 variants: Yard + Sample)
# staggered under Shopify's 1,000-variant/day cap. push-shopify.js is
# idempotent-by-SKU + has a legacy-peer guard, so it ONLY ever creates rows
# that aren't already on the store — safe to run every day until the catalog
# is fully onboarded. The pusher defers gracefully on VARIANT_THROTTLE_EXCEEDED.
#
# Manual run: bash daily-push.sh
# Launchd runs it ~11:00 AM daily (see com.steve.wolfgordon-daily-push.plist).
# ============================================================================
set -euo pipefail
REPO="$HOME/Projects/wolfgordon-crawl"
cd "$REPO"
# 480 products = 960 variants/day, comfortably under the 1k cap.
MAX="${WG_DAILY_MAX:-480}"
LOG="$REPO/logs/daily-push-$(date +%Y%m%d-%H%M%S).log"
mkdir -p "$REPO/logs"
# Prefer Homebrew node (launchd PATH is minimal).
export PATH="/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin:$PATH"
{
echo "=== Wolf Gordon daily Phase-2 push — $(date) ==="
node push-shopify.js --new-only --max "$MAX" --apply
echo "=== done — $(date) ==="
} >> "$LOG" 2>&1
# Surface the tail so a foreground run still shows the result.
tail -n 20 "$LOG"