#!/bin/bash # chain4.sh — the drill pass again, through the box's local mirror (chain3's drill pass ran on the live templates: # the box's clone of the private drill repo failed, see repoint.py). n8n, opengist, vaultwarden: chain3's runs are kept # as run-live-2 (they are live-catalog runs). Stops before any install if the drill is not CONFIRMED on the box. E=/mnt/5_hdd/felhom.eu/git/felhom.eu/documentation/audits/catalog-sweep-2026-10-24 export SC=/run/user/1000/sweep-sc TARGET=sweep BASE=https://192.168.0.157 DRIVE_ROOT=/mnt/felhom-drives/hdd_1 SWEEP_EV=$E cd $E/tools G() { ssh -n -o BatchMode=yes root@192.168.0.138 "pct exec 9201 -- bash -c \"$1\""; } keep_first() { a=$1; if [ -d "$E/$a" ] && [ ! -d "$E/$a/run-$2" ]; then mkdir -p "$E/$a/run-$2"; find "$E/$a" -maxdepth 1 -mindepth 1 ! -name 'first-run' ! -name 'run-*' -exec mv {} "$E/$a/run-$2/" \; ; fi; } relogin() { sec run SWEEP_2026_10_24_DASH_PW -- bash brun.sh --env SWEEP_2026_10_24_DASH_PW:PW --push steps-login.json -- /opt/pw/bin/python /root/work/ui.py /root/work/steps-login.json > /dev/null 2>&1; } wait_ctl() { for i in $(seq 1 60); do s=$(G "docker inspect -f {{.State.Health.Status}} felhom-controller" 2>/dev/null); [ "$s" = healthy ] && return 0; sleep 5; done; return 1; } echo "$(date -u +%T) REPOINT drill (mirror)" >> $E/progress.log if ! python3 repoint.py drill >> $E/_drill-repoint.txt 2>&1 < /dev/null; then echo "$(date -u +%T) WARN drill NOT confirmed — no install; back to live" >> $E/progress.log python3 repoint.py live >> $E/_drill-repoint.txt 2>&1 < /dev/null wait_ctl; sleep 20; relogin echo "$(date -u +%T) REPOINT live; CHAIN4 DONE (aborted)" >> $E/progress.log exit 1 fi wait_ctl; sleep 20; relogin # the positive observable for a601950: the RUNNING n8n container carries the variable (only that line is read) ( for i in $(seq 1 120); do v=$(G "docker inspect --format '{{range .Config.Env}}{{println .}}{{end}}' n8n 2>/dev/null | grep -E '^N8N_DIAGNOSTICS_ENABLED='") if [ -n "$v" ]; then echo "$(date -u +%T) n8n container env: $v" >> $E/_drill-repoint.txt; break; fi sleep 10 done ) & for a in n8n opengist vaultwarden; do keep_first $a live-2 echo "$(date -u +%T) START drill2 $a" >> $E/progress.log if [ $a = vaultwarden ]; then FELHOM_BOX_ADMIN_SEED=1 timeout 2700 python3 sweep.py $a > $E/$a.console.txt 2>&1 < /dev/null; else timeout 2700 python3 sweep.py $a > $E/$a.console.txt 2>&1 < /dev/null; fi echo "$(date -u +%T) END drill2 $a rc=$?" >> $E/progress.log done python3 repoint.py live >> $E/_drill-repoint.txt 2>&1 < /dev/null wait_ctl; sleep 20; relogin echo "$(date -u +%T) REPOINT live; CHAIN4 DONE" >> $E/progress.log