- Add scripts/lib/common.sh (ORG/BOT/FORGE_BACKEND, logging, process_running) - discover.sh: dedupe review-requested+assignee PRs; JSON+summary formats - discover.sh: FORGE_BACKEND=forgejo via Forgejo API + stoke token - Fix poll-loop process detection (basename, not install path) - health-check: jq-safe JSON; backend-aware auth (gh or stoke) - install-live: require rsync/jq/tmux; soft-warn missing gh/stoke - self-test.sh offline smoke; restore/poll-once use shared config - Docs: Forgejo table, watcher.env, OPERATIONS troubleshooting
27 lines
822 B
Bash
Executable file
27 lines
822 B
Bash
Executable file
#!/usr/bin/env bash
|
|
# Long-running poll loop (default 15 minutes) for tmux.
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
# shellcheck source=lib/common.sh
|
|
source "${SCRIPT_DIR}/lib/common.sh"
|
|
|
|
INTERVAL_SEC="${POLL_INTERVAL_SEC}"
|
|
mkdir -p "${LOG_DIR}"
|
|
|
|
watcher_log "${LOG_DIR}/poll.log" \
|
|
"poll-loop started interval=${INTERVAL_SEC}s scope=org:${ORG} backend=${FORGE_BACKEND} (sleep-first)"
|
|
|
|
if [[ "${POLL_NOW:-0}" == "1" ]]; then
|
|
"${WATCHER_DIR}/scripts/poll-once.sh" || true
|
|
fi
|
|
|
|
while true; do
|
|
sleep "${INTERVAL_SEC}"
|
|
# Match by script basename so WATCHER_DIR reinstalls / path moves still work.
|
|
if process_running 'poll-once\.sh'; then
|
|
watcher_log "${LOG_DIR}/poll.log" "poll-loop: previous poll still running, skipping"
|
|
else
|
|
"${WATCHER_DIR}/scripts/poll-once.sh" || true
|
|
fi
|
|
done
|