#!/bin/bash # batch.sh ORDERFILE — the sweep, one app after another; every 5th app also restores from its recovery unit. 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; n=0 while read -r app; do [ -n "$app" ] || continue; n=$((n+1)); [ -f "$E/$app/record.json" ] && [ "${REDO:-}" != "$app" ] && { echo "$(date -u +%T) SKIP $app (has a record)" >> $E/progress.log; continue; } r=""; [ $((n % 5)) -eq 0 ] && r="--restore" case "$app" in immich|nextcloud|onlyoffice|home-assistant|plex|jellyfin|emby|n8n|gitea|outline|calcom) lim=5400;; *) lim=2700;; esac echo "$(date -u +%T) START $n $app $r" >> $E/progress.log timeout $lim python3 sweep.py "$app" $r > $E/$app.console.txt 2>&1 < /dev/null; rc=$? echo "$(date -u +%T) END $n $app rc=$rc" >> $E/progress.log left=$(ssh -n -o BatchMode=yes root@192.168.0.138 "pct exec 9201 -- sh -c 'ls /opt/docker/stacks/*/app.yaml 2>/dev/null'" 2>/dev/null) [ -n "$left" ] && echo "$(date -u +%T) WARN installed after $app: $left" >> $E/progress.log done < "$1" echo "$(date -u +%T) BATCH DONE" >> $E/progress.log