#!/usr/bin/env bash # queue-serial.sh — run TASK files one at a time, pacing against the z.ai # concurrency semaphore. Each line: . Stops at first # rc!=0 after logging (PMO refeeds on heartbeat). set -u QUEUE="/home/reachableceo/.coordinate/logs/serial-queue.txt" LOGD="/home/reachableceo/.coordinate/logs" while read -r name task; do [ -z "$name" ] && continue echo "$(date -Is) START $name" >> "$LOGD/serial-queue.log" bash /home/reachableceo/.coordinate/scripts/dispatch-turn.sh "$name" "$task" >> "$LOGD/q-$name.log" 2>&1 rc=$? echo "$(date -Is) END $name rc=$rc" >> "$LOGD/serial-queue.log" [ "$rc" -ne 0 ] && { echo "$(date -Is) QUEUE STOPPED at $name rc=$rc" >> "$LOGD/serial-queue.log"; exit "$rc"; } done < "$QUEUE" echo "$(date -Is) QUEUE DRAINED" >> "$LOGD/serial-queue.log"