#!/bin/bash
# Workbench data refresh pipeline — 4 concurrent pulls (verification run)
cd "/Users/liuxinyuan/Desktop/Hermes输出-工作类/数据" || exit 9
echo "start $(date '+%F %T')"

python3 pull_complaints.py            > /tmp/rv_complaints.log  2>&1 &
P1=$!
python3 _pull_segmented.py customers  > /tmp/rv_customers.log   2>&1 &
P2=$!
python3 _pull_segmented.py activities --days 80 > /tmp/rv_activities.log 2>&1 &
P3=$!
python3 pull_orders.py --months 2     > /tmp/rv_orders.log      2>&1 &
P4=$!

wait $P1; echo "complaints exit=$?"
wait $P2; echo "customers  exit=$?"
wait $P3; echo "activities exit=$?"
wait $P4; echo "orders     exit=$?"
echo "ALL_DONE $(date '+%F %T')"
