Files
felhom.eu/documentation/audits/os-updates-spike-2026-10-04/scripts/h-run.sh
T

16 lines
1.7 KiB
Bash

#!/bin/bash
# h-run.sh — the Debian fast-lane update on demo-hp's HOST (Part H 2). No Proxmox-origin package, no dist-upgrade.
export LC_ALL=C DEBIAN_FRONTEND=noninteractive APT_LISTCHANGES_FRONTEND=none NEEDRESTART_MODE=l
( while [ ! -f /root/h-stop ]; do echo "$(date -u +%T) 9201=$(pct status 9201 | awk '{print $2}') 9202=$(pct status 9202 | awk '{print $2}') ctl9201=$(pct exec 9201 -- docker inspect -f '{{.State.Status}}/{{.State.Health.Status}}' felhom-controller 2>/dev/null) agent=$(systemctl is-active felhom-agent) pveproxy=$(systemctl is-active pveproxy)"; sleep 2; done ) > /root/h-sampler.txt 2>&1 &
SP=$!
systemctl list-units --type=service --state=running --no-legend --plain | awk '{print $1}' | while read u; do echo "$u $(systemctl show -p MainPID --value $u)"; done | sort > /root/h-svc-before.txt
df -B1 --output=used / | tail -1 > /root/h-df-before.txt
s=$(date +%s.%N)
apt-get install -y -q --only-upgrade -o Dpkg::Options::=--force-confold -o Dpkg::Options::=--force-confdef $(cat /root/h-debian-pkgs.txt) > /root/h-apt-run.log 2>&1
echo "apt_rc=$? seconds=$(awk -v a=$s -v b=$(date +%s.%N) 'BEGIN{printf "%.1f", b-a}')" > /root/h-result.txt
du -sb /var/cache/apt/archives >> /root/h-result.txt; df -B1 --output=used / | tail -1 | sed 's/^/used_after /' >> /root/h-result.txt
apt-get clean; df -B1 --output=used / | tail -1 | sed 's/^/used_after_clean /' >> /root/h-result.txt; sed 's/^/used_before /' /root/h-df-before.txt >> /root/h-result.txt
systemctl list-units --type=service --state=running --no-legend --plain | awk '{print $1}' | while read u; do echo "$u $(systemctl show -p MainPID --value $u)"; done | sort > /root/h-svc-after.txt
sleep 6; touch /root/h-stop; wait $SP
echo done >> /root/h-result.txt