#!/usr/bin/env bash # install-firecuda-timer.sh — OPTIONAL: rsync suite to firecuda + launchd every 4h # # POLICY (2026-07): firecuda launchd is **disabled**. Prefer koopa host-agent. # This script remains for documentation / future re-enable only. # Do not run unless you intentionally want a second outside-only scheduler. # # ./install-firecuda-timer.sh # ./install-firecuda-timer.sh --run-now # set -euo pipefail ROOT=$(cd "$(dirname "$0")" && pwd) MON_ROOT=$(cd "$ROOT/.." && pwd) FIRECUDA="${FIRECUDA_SSH:-}" if [ -z "$FIRECUDA" ]; then echo "Set FIRECUDA_SSH to your outside-runner SSH host alias" >&2 exit 2 fi REMOTE_BASE="${FIRECUDA_INSTALL_DIR:-taler-monitoring-site-gen}" RUN_NOW=0 [ "${1:-}" = "--run-now" ] && RUN_NOW=1 echo "install → $FIRECUDA:~/$REMOTE_BASE (outside-only, every 4h)" ssh -o BatchMode=yes -o ConnectTimeout=20 "$FIRECUDA" \ "mkdir -p \"\$HOME/$REMOTE_BASE\" \"\$HOME/Library/Logs/taler-monitoring-sites\" \"\$HOME/var/taler-monitoring-sites-work\" \"\$HOME/Library/LaunchAgents\"" # Sync full taler-monitoring suite (no secrets.env) rsync -az --delete \ --exclude secrets.env \ --exclude 'android-test/artifacts' \ --exclude '.git' \ --exclude 'site-gen/settings.conf' \ "$MON_ROOT/" \ "${FIRECUDA}:$REMOTE_BASE/" # settings on firecuda: outside only, run locally on firecuda, deploy to koopa ssh -o BatchMode=yes "$FIRECUDA" "cat > \"\$HOME/$REMOTE_BASE/site-gen/settings.conf\" <<'EOF' # auto-installed by install-firecuda-timer.sh — no secrets RUNNER_SSH= SKIP_SSH=1 CONTINUE_ON_ERROR=1 PHASES_ERR=urls versions PHASES_OK=urls versions DEPLOY_SSH=${DEPLOY_SSH:-} DEPLOY_STAGING=${DEPLOY_STAGING:-$HOME/monitoring-sites-staging} WORK_ROOT= MONITORING_ROOT=.. SOURCE_REPO_WEB=https://git.hacktivism.ch/hernani/taler-monitoring SOURCE_COMMIT_URL_TMPL={repo}/src/commit/{commit} SOURCE_SUITE_PATH=. EOF # WORK_ROOT expanded on remote sed -i.bak \"s|^WORK_ROOT=.*|WORK_ROOT=\$HOME/var/taler-monitoring-sites-work|\" \"\$HOME/$REMOTE_BASE/site-gen/settings.conf\" 2>/dev/null || \ sed -i '' \"s|^WORK_ROOT=.*|WORK_ROOT=\$HOME/var/taler-monitoring-sites-work|\" \"\$HOME/$REMOTE_BASE/site-gen/settings.conf\" " # launchd plist with absolute paths ssh -o BatchMode=yes "$FIRECUDA" bash -s < "\$PLIST_DST" chmod +x "\$SITE_GEN"/*.sh "\$SITE_GEN"/console_to_html.py 2>/dev/null || true chmod +x "\$SITE_GEN/run-on-firecuda.sh" launchctl bootout "gui/\$(id -u)/com.hacktivism.taler-monitoring-sites" 2>/dev/null || true launchctl unload "\$PLIST_DST" 2>/dev/null || true launchctl bootstrap "gui/\$(id -u)" "\$PLIST_DST" 2>/dev/null || launchctl load "\$PLIST_DST" launchctl enable "gui/\$(id -u)/com.hacktivism.taler-monitoring-sites" 2>/dev/null || true launchctl print "gui/\$(id -u)/com.hacktivism.taler-monitoring-sites" 2>/dev/null | head -20 || launchctl list | grep taler-monitoring || true echo "OK: launchd com.hacktivism.taler-monitoring-sites (StartInterval=14400)" REMOTE if [ "$RUN_NOW" = "1" ]; then echo "run once now…" ssh -o BatchMode=yes "$FIRECUDA" "\"\$HOME/$REMOTE_BASE/site-gen/run-on-firecuda.sh\"" || true fi echo "done. logs: $FIRECUDA:~/Library/Logs/taler-monitoring-sites/" echo "manual: ssh $FIRECUDA '~/taler-monitoring-site-gen/site-gen/run-on-firecuda.sh'"