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}"