← back to Dw Marketing Reels
scripts/cron-run.sh
27 lines
#!/bin/zsh
# Nightly: refresh feed → render reel locally ($0) → auto-post to social (fail-safe:
# simulates/queues until creds land) → push reels + data to the Kamatera console.
export PATH="/opt/homebrew/bin:/usr/local/bin:$PATH"
export HYPERFRAMES_SKIP_SKILLS=1
cd "$(dirname "$0")/.."
[ -f .env ] && set -a && source .env && set +a
node scripts/fetch-new-arrivals.mjs && node scripts/build-reel.mjs || exit 1
# LEAK GATE (fail-closed, 2026-07-27): a private-label / upstream name in the staged
# manifests must NEVER reach a public post or the console. If scan-leaks finds a hit it
# exits non-zero and we abort BEFORE publish + push. Turns the old one-shot manual "0
# leaks" check into a standing gate.
node scripts/scan-leaks.mjs || { echo "LEAK GATE FAILED — aborting publish+push"; exit 1; }
# auto-post (Steve: auto-post on the nightly schedule). Runs on Mac3 where Norma/tiktok live.
SOCIAL_AUTOPOST="${SOCIAL_AUTOPOST:-1}" node scripts/publish-social.mjs
PUSH_HOST="${PUSH_HOST:-root@45.61.58.125}"
PUSH_PATH="${PUSH_PATH:-/root/public-projects/dw-marketing-reels}"
if ssh -o BatchMode=yes -o ConnectTimeout=6 "$PUSH_HOST" "test -d $PUSH_PATH" 2>/dev/null; then
rsync -az reels/ "$PUSH_HOST:$PUSH_PATH/reels/"
rsync -az data/ "$PUSH_HOST:$PUSH_PATH/data/"
echo "pushed reels+data -> $PUSH_HOST:$PUSH_PATH"
fi