From 6ffd3534bdbc4593866256bf7e93157f13861bc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Padez?= Date: Wed, 12 Aug 2026 18:09:03 +0000 Subject: [PATCH] do not offer the ballast on a dev machine, and route its alerts through one place MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Servers only now. On a machine you sit at, a filling disk announces itself — the editor refuses to save, the browser complains — and you are there to deal with it. The reserve is for the box nobody is watching, where the first sign is a service that stopped working hours ago. Skipped rather than asked, but said out loud with the reason and recorded in the summary. A section that silently produces no output is indistinguishable from one that failed. The cron this section installs was already there and is unchanged: /etc/cron.d runs the checker as root every ten minutes, and it deletes the ballast when free space falls under the threshold. What changed is where its message goes. Both alerts now run through one notify() inside the generated checker rather than calling logger directly, so there is a single place to add a second channel. Today it is still syslog only — the message lands in the journal and nowhere else, so nobody learns about it until they go looking, which is precisely the wrong moment. Push, mail or Officer's own notify sidecar hook in there. It also echoes to stderr now, so running the checker by hand shows the message instead of appearing to do nothing. Verified: dev reports not-applicable and asks nothing, vps still asks and records a refusal, and the regenerated checker parses and reports status. Co-Authored-By: Claude Opus 5 (1M context) --- scripts/setup/machine-setup/lib/system.sh | 17 +++++++++++++---- scripts/setup/machine-setup/machine-setup.sh | 19 +++++++++++++------ 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/scripts/setup/machine-setup/lib/system.sh b/scripts/setup/machine-setup/lib/system.sh index ee1ec830..2e1ecccc 100644 --- a/scripts/setup/machine-setup/lib/system.sh +++ b/scripts/setup/machine-setup/lib/system.sh @@ -272,16 +272,25 @@ if [[ "\${1:-}" == "--status" ]]; then exit 0 fi +# Everything urgent goes through here, so there is one place to add a second +# channel later. Today it is syslog only, which means the message is in the +# journal and nowhere else — nobody finds out until they go looking, which is +# exactly the wrong moment. Push, mail or Officer's own notify sidecar hook in +# here. +notify() { + logger -t "\$TAG" -p user.crit "\$1" + # A copy on stderr as well, so a human running this by hand sees it. + echo "\$1" >&2 +} + ((FREE_PCT < THRESHOLD)) || exit 0 if [[ -f "\$BALLAST" ]]; then FREED="\$(du -h "\$BALLAST" | cut -f1)" rm -f "\$BALLAST" - logger -t "\$TAG" -p user.crit \\ - "Free space \${FREE_PCT}% below \${THRESHOLD}% — deleted ballast, reclaimed \${FREED}. CLEAN UP NOW: this valve is spent." + notify "Free space \${FREE_PCT}% below \${THRESHOLD}% — deleted ballast, reclaimed \${FREED}. CLEAN UP NOW: this valve is spent." else - logger -t "\$TAG" -p user.crit \\ - "Free space \${FREE_PCT}% below \${THRESHOLD}% — ballast already spent, no headroom left to reclaim." + notify "Free space \${FREE_PCT}% below \${THRESHOLD}% — ballast already spent, no headroom left to reclaim." fi CHECKER diff --git a/scripts/setup/machine-setup/machine-setup.sh b/scripts/setup/machine-setup/machine-setup.sh index 1ee807bf..95422092 100755 --- a/scripts/setup/machine-setup/machine-setup.sh +++ b/scripts/setup/machine-setup/machine-setup.sh @@ -427,7 +427,19 @@ fi # recommendation points. step "Emergency disk ballast" -if ! skip; then +# Servers only. On a machine you sit at, the disk filling up announces itself — +# the editor refuses to save, the browser complains — and you are there to deal +# with it. The reserve is for the box nobody is watching, where the first sign is +# a service that stopped working hours ago. Skipped rather than offered, but said +# out loud, so a silent gap in the run is never left unexplained. +if ! skip && ! is_server; then + echo "" + info "Emergency disk ballast — not offered on a ${MACHINE_ROLE} machine" + echo " The reserve is for a box nobody is watching. You are sitting at" + echo " this one, so a filling disk tells you itself." + SUMMARY+=("Disk ballast: not applicable on ${MACHINE_ROLE}") + step_ok +elif ! skip; then echo "" info "Emergency disk ballast — a reserve you can burn when the disk fills up" echo " A file holding nothing, whose only job is to be deleted. A root cron" @@ -438,11 +450,6 @@ if ! skip; then echo " own." echo "" echo " It is a one-shot valve: once spent, run this again to recreate it." - if is_server; then - echo " Worth having on ${MACHINE_ROLE} — a full disk on an unattended box is the bad case." - else - echo " Less useful on ${MACHINE_ROLE} — you are sitting at this machine and will notice." - fi if [[ -f "${USER_HOME}/${BALLAST_NAME}" ]]; then BALLAST_FILE="${USER_HOME}/${BALLAST_NAME}"; fi [[ -f "${OFFICER_ROOT}/${BALLAST_NAME}" ]] && BALLAST_FILE="${OFFICER_ROOT}/${BALLAST_NAME}"