Files
mrcharles 79d93b6c49 ops(scripts): dispatch, queue gating, heartbeat, quota probe
dispatch-turn.sh (headless turn launcher with TURN_MODEL routing),
queue-after.sh (serial gate chain + quota-wall guard), pmo-heartbeat.sh
(PMO wake loop), quota-probe-then-chain.sh (post-wall relaunch).
2026-08-29 05:22:43 -05:00

21 lines
838 B
Bash
Executable File

#!/usr/bin/env bash
# pmo-heartbeat.sh — wake the PMO session while the overnight chain runs.
# Self-terminates when inbox-work has no TASKs AND no semaphore slots are held.
INBOX=/home/reachableceo/.coordinate/inbox-work
SLOTS=/home/_crossfeed/metrics/active
LOG=/home/reachableceo/.coordinate/logs/heartbeat.log
INTERVAL=3600
while true; do
pending=$(ls -1 "$INBOX"/TASK-*.md 2>/dev/null | wc -l)
active=$(ls -1 "$SLOTS"/*.pid 2>/dev/null | wc -l)
if [ "$pending" -eq 0 ] && [ "$active" -eq 0 ]; then
echo "$(date -Is) chain drained — heartbeat exiting" >> "$LOG"
exit 0
fi
screen -S RCEO-PMO -X stuff "hb: chain check — verify reports, archive, mirror redmine, redispatch flakes, dispatch next$(printf '\r')"
echo "$(date -Is) wake sent (pending=$pending active=$active)" >> "$LOG"
sleep "$INTERVAL"
done