#!/bin/bash
# Hermithire overnight send — 152 remaining contacts
# Batches of 50, 20s between emails, 10min between batches, 2hr cooldown first
# Run with: nohup bash send_tonight.sh &

LOG="/Users/archieshouse/hermithire-campaign/tracking/overnight.log"
CAMP="/Users/archieshouse/hermithire-campaign"

log() { echo "[$(date '+%H:%M:%S')] $1" | tee -a "$LOG"; }

log "=== Overnight send started ==="
log "Waiting 2 hours for Zoho cooldown..."
sleep 7200

log "--- Batch 1 (up to 50) ---"
python3 "$CAMP/campaign.py" send --touch 1 --limit 50 2>&1 | tee -a "$LOG"

log "Pausing 10 minutes between batches..."
sleep 600

log "--- Batch 2 (up to 50) ---"
python3 "$CAMP/campaign.py" send --touch 1 --limit 50 2>&1 | tee -a "$LOG"

log "Pausing 10 minutes between batches..."
sleep 600

log "--- Batch 3 (up to 50) ---"
python3 "$CAMP/campaign.py" send --touch 1 --limit 50 2>&1 | tee -a "$LOG"

log "Pausing 10 minutes between batches..."
sleep 600

log "--- Batch 4 (up to 50, mop-up) ---"
python3 "$CAMP/campaign.py" send --touch 1 --limit 50 2>&1 | tee -a "$LOG"

log "=== All done. Check tracking/overnight.log for results. ==="
