surrogate-1-shard3 / bin /github-agentic-crawler.sh
Ashira Pitchayapakayakul
sync: pull axentx-master c14673b β€” twin harvest worker
72af6ea
raw
history blame contribute delete
878 Bytes
#!/usr/bin/env bash
# Wrapper for github-agentic-crawler.py β€” runs continuously with auto-restart.
set -uo pipefail
set -a; source "$HOME/.hermes/.env" 2>/dev/null; set +a
LOG="$HOME/.surrogate/logs/github-agentic-crawler.log"
mkdir -p "$(dirname "$LOG")"
if [[ -z "${GITHUB_TOKEN_POOL:-}" ]]; then
echo "[$(date +%H:%M:%S)] WARN: GITHUB_TOKEN_POOL empty β€” exiting" | tee -a "$LOG"
exit 0
fi
POOL_SIZE=$(echo "$GITHUB_TOKEN_POOL" | tr ',' '\n' | wc -l | tr -d ' ')
echo "[$(date +%H:%M:%S)] github-agentic-crawler start (pool=$POOL_SIZE tokens, ~$((POOL_SIZE * 5000)) req/h)" | tee -a "$LOG"
# Run continuously; if Python crashes, sleep 30s and restart
while true; do
python3 "$HOME/.surrogate/bin/github-agentic-crawler.py" 0 >> "$LOG" 2>&1
rc=$?
echo "[$(date +%H:%M:%S)] crawler exited rc=$rc β€” restart in 30s" | tee -a "$LOG"
sleep 30
done