← back to Beverlyhillsvideos
filmgen/batch_loop.sh
21 lines
#!/bin/bash
# Autonomous restaurant-film batch runner. Polls/submits via heygen_batch.mjs,
# and when a new film downloads, rebuilds + deploys the live site.
# Bounded: heygen_batch.mjs only submits the 16 known scripts, <=3 concurrent, wallet floor $150.
cd /Users/macstudio3/Projects/beverlyhillsvideos || exit 1
DEPLOY="root@45.61.58.125:/root/public-projects/beverlyhillsvideos/public/"
for i in $(seq 1 45); do
echo "===== cycle $i · $(date '+%H:%M:%S') ====="
out=$(node filmgen/heygen_batch.mjs); rc=$?
echo "$out"
if echo "$out" | grep -q 'downloaded'; then
echo "-- new film(s): rebuild + deploy --"
node build.mjs
rsync -az --delete public/ "$DEPLOY" >/dev/null 2>&1
ssh root@45.61.58.125 "pm2 restart beverlyhillsvideos --update-env >/dev/null 2>&1"
git add -A && git commit -q -m "films: integrate completed restaurant film(s) [auto]" 2>/dev/null
fi
[ $rc -eq 0 ] && { echo "===== BATCH COMPLETE ====="; break; }
sleep 720
done