Simplify and clean up backup script

This commit is contained in:
Anthony Wang 2022-05-24 14:55:15 -05:00
parent 406844da9b
commit d091e5778d
Signed by: a
GPG key ID: BC96B00AEC5F2D76
2 changed files with 33 additions and 42 deletions

44
backup
View file

@ -3,13 +3,7 @@
# https://gist.github.com/bradfa/a710a4e4b83b07b7a8be77cae86ff56b
# https://gist.github.com/jasontbradshaw/6a69d7c9ae0c73f54200
# We name the repository directory after the system's hostname and the current
# year/month. We include the year/month combo so our backup repository doesn't
# continue to grow forever, and we can manually delete old ones as necessary.
# name="$(hostname)"
name="$(date -u +'%Y-%m-%d')"
# repository_dir="$(dirname "${1:-}/gets-removed")"
# repository="${repository_dir}/${name}/$(date -u +'%Y-%m')"
repository=/mnt/drive/bup/
# Set the `bup` directory here so it affects all the `bup` commands.
@ -23,41 +17,7 @@ fi
# Do the backup as non-intrusively as possible.
echo "Indexing ${name}..."
nice -n19 ionice -c3 \
bup index -vv \
--exclude='/var/tmp' \
--exclude='/var/log/journal' \
--exclude='/var/lib/systemd/coredump' \
--exclude='/var/lib/woodpecker-agent' \
--exclude='/var/lib/gitea/indexers' \
--exclude='/var/lib/peertube/storage/thumbnails' \
--exclude='/var/lib/synapse/media_store/remote_content' \
--exclude='/var/lib/synapse/media_store/remote_thumbnail' \
--exclude-rx='.go' \
--exclude-rx='.3ds' \
--exclude-rx='.xci' \
--exclude-rx='.nsp' \
--exclude-rx='.wbfs' \
--exclude-rx='.wine' \
--exclude-rx='.yarn' \
--exclude-rx='.qcow2' \
--exclude-rx='.julia' \
--exclude-rx='.cargo' \
--exclude-rx='.nix-profile' \
--exclude-rx='venv' \
--exclude-rx='cache' \
--exclude-rx='Cache' \
--exclude-rx='vendor' \
--exclude-rx='node_modules' \
--exclude-rx='.local/share/yuzu' \
--exclude-rx='.local/share/Trash' \
--exclude-rx='.local/share/containers' \
--exclude-rx='.local/share/torbrowser' \
'/etc' '/var' '/srv' '/home/ta180m'
nice -n19 ionice -c3 bup index -vv --exclude-rx-from=exclude /etc /var /srv /home/ta180m
echo "Backing up ${name} to '${repository}'..."
nice -n19 ionice -c3 \
bup save -vv \
--name="${name}" \
--compress=9 \
'/'
nice -n19 ionice -c3 bup save -vv --name="${name}" --compress=9 /

31
exclude Normal file
View file

@ -0,0 +1,31 @@
/var/tmp
/var/log/journal
/var/lib/systemd/coredump
/var/lib/woodpecker-agent
/var/lib/gitea/indexers
/var/lib/peertube/storage/thumbnails
/var/lib/synapse/media_store/remote_content
/var/lib/synapse/media_store/remote_thumbnail
.go
.3ds
.xci
.nsp
.npm
.wbfs
.wine
.yarn
.qcow2
.julia
.cargo
.phoronix-test-suite
venv
cache
Cache
vendor
node_modules
.local/share/yuzu
.local/share/Trash
.local/share/containers
.local/share/torbrowser