config

System config files for garbash.com
git clone git://git.garbash.com/alex/config
Log | Files | Refs | README | LICENSE

commit 2a2533c367a22f3ae95fcada27ee15a8f5b5564d
parent 42f5ec2dc8795c36d26f40e5f601738a2b450359
Author: alex <alex@garbash.com>
Date:   Wed, 13 Oct 2021 00:38:55 -0400

backups: Consolidate dump logic into "dumpster" tool

This tool combines the weekly and daily dumps into a single
tool with the dump pattern:

	0 (sundays / weekly cron)
	1 2 3 4 5 6 7 (mon - sun, daily)

The benefit here is that we can see what changed on a day-to-day
basis (starting from the beginning of the week), which also
minimizes the size of each dump. This comes at the cost of a
full system rebuild taking potentially 7 restores (but in reality,
we probably would just restore from 0 and grab select files for
users...)

While we're here, I also removed the dump's of /usr and /usr/local.
Both are big (~1GB) and not worth storing (since we don't expect
them to change _too_ much / we can always reinstall the packages
which are backed up with /var/backups/pkglist).

Diffstat:
MMakefile | 1+
Metc/daily.local | 10+---------
Metc/weekly.local | 10++--------
Ausr/local/bin/dumpster | 11+++++++++++
4 files changed, 15 insertions(+), 17 deletions(-)

diff --git a/Makefile b/Makefile @@ -8,6 +8,7 @@ FILES = /etc/httpd.conf \ /usr/local/bin/newrepo \ /usr/local/man/man1/newrepo.1 \ /usr/local/bin/wggen \ + /usr/local/bin/dumpster \ /usr/local/man/man8/wggen.8 \ /home/_soju/soju.cfg diff --git a/etc/daily.local b/etc/daily.local @@ -1,10 +1,2 @@ ROOTBACKUP=1 - -BAKDIR="/bak/$(date +%F)" -mkdir -p "$BAKDIR" - -dump -1auf "$BAKDIR/root.dump.1" / -dump -1auf "$BAKDIR/home.dump.1" /home -dump -1auf "$BAKDIR/usr.dump.1" /usr -dump -1auf "$BAKDIR/usr-local.dump.1" /usr/local -dump -1auf "$BAKDIR/var.dump.1" /var +/usr/local/bin/dumpster diff --git a/etc/weekly.local b/etc/weekly.local @@ -1,8 +1,2 @@ -BAKDIR="/bak/$(date +%F)" -mkdir -p "$BAKDIR" - -dump -0auf "$BAKDIR/root.dump.0" / -dump -0auf "$BAKDIR/home.dump.0" /home -dump -0auf "$BAKDIR/usr.dump.0" /usr -dump -0auf "$BAKDIR/usr-local.dump.0" /usr/local -dump -0auf "$BAKDIR/var.dump.0" /var +# force a 0-level (full) dump +/usr/local/bin/dumpster 0 diff --git a/usr/local/bin/dumpster b/usr/local/bin/dumpster @@ -0,0 +1,11 @@ +#!/bin/sh +# dumpster -- taking out the garbash with dump(8) + +# %u is 1=mon 7=sun (unless given in ARGV) +LVL=${1:-"$(date +%u)"} +BAKDIR="/bak/$(date +%F)_$LVL" + +mkdir -p "$BAKDIR" +dump -$LVL -auf "$BAKDIR/root.dump.$LVL" / +dump -$LVL -auf "$BAKDIR/home.dump.$LVL" /home +dump -$LVL -auf "$BAKDIR/var.dump.$LVL" /var