Make backup pruning fully automatic, no prompt

The safety net (only ever touches disposable *.backup.* files, never
the newest one for any given file) makes this low-stakes enough to
just set up unprompted, the same way tab completion already is —
matches the user's own read on it. Still fully idempotent (skipped if
the timer already exists), so a rerun doesn't re-ask or redo anything.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01H4k6J1qXXyYxhGEgnJaMvn
This commit is contained in:
Claude
2026-08-11 04:56:43 +00:00
parent c50704e1b3
commit 3584ad6499
2 changed files with 13 additions and 12 deletions
+7 -4
View File
@@ -322,10 +322,13 @@ docker compose down # stop
Every service in this repo backs up a live config before overwriting it —
`Caddyfile.backup.<timestamp>`, `/etc/fstab.backup.<timestamp>`, and so on —
but nothing cleans those up afterward, so they build up on any box
reconfigured regularly. `base` offers a daily systemd timer
(`prune-old-backups`) that removes anything older than 30 days, always
keeping at least the single newest backup per file regardless of age — a
box left alone for months never ends up with zero backups for something.
reconfigured regularly. `base` sets up a daily systemd timer
(`prune-old-backups`), automatically and without asking (the same way it
sets up [tab completion](#tab-completion) — low-stakes enough not to need
a prompt, and idempotent either way), that removes anything older than 30
days, always keeping at least the single newest backup per file regardless
of age — a box left alone for months never ends up with zero backups for
something.
```bash
sudo bash tools/prune-old-backups.sh [KEEP_DAYS] # run by hand, default 30