← back to Fentucci Naturals
scripts/cadence-import.sh
25 lines
#!/usr/bin/env bash
# Daily cadence tranche for the Fentucci Naturals (Tokiwa) draft import.
# Steve-approved 2026-07-22: "run on std cadence with other lines".
# 245 products/run (490 variants) = half the 1k/day variant budget, shared
# with the other lines' import jobs. Resumable via data/created.jsonl —
# exits 0 with a no-op once all 504 are created.
set -u
ROOT="$HOME/Projects/fentucci-naturals"
LOG="$ROOT/logs/cadence-import.log"
mkdir -p "$ROOT/logs"
# grep-export, never `source` — an unquoted value in the secrets .env aborts set -a sourcing
SHOPIFY_ADMIN_TOKEN=$(grep '^SHOPIFY_ADMIN_TOKEN=' "$HOME/Projects/secrets-manager/.env" | cut -d= -f2- | tr -d '"')
export SHOPIFY_ADMIN_TOKEN
{
echo "=== fentucci cadence tranche $(date '+%Y-%m-%d %H:%M:%S') ==="
_f="$ROOT/data/created.jsonl"; created=$([ -f "$_f" ] && wc -l < "$_f" || echo 0)
total=$(wc -l < "$ROOT/data/shopify-drafts.jsonl")
if [ "$created" -ge "$total" ]; then
echo "all $total drafts created — nothing to do"
else
cd "$ROOT" && python3 scripts/create-drafts.py --limit 245
fi
echo "=== done $(date '+%Y-%m-%d %H:%M:%S') — $([ -f "$_f" ] && wc -l < "$_f" || echo 0)/$total created ==="
} >> "$LOG" 2>&1