aboutsummaryrefslogtreecommitdiff
path: root/stow/duplicity/.local/bin/backup
diff options
context:
space:
mode:
authorMatt Singleton <matt@xcolour.net>2024-04-11 16:21:15 -0500
committerMatt Singleton <matt@xcolour.net>2024-04-11 16:21:15 -0500
commitf2dfde23f8157da1532a2b2e236af529fed47713 (patch)
treed5eabb0eb33d100304ee16596b2a43dfb4a68d1c /stow/duplicity/.local/bin/backup
parent7f67d28e18760154778f20da43772838c36734ed (diff)
replace janky deploy script with stow and make
re-orgs all the console oriented dotfiles to be stowable makefile to deploy everything move from vimplug to native vim packages cleanup script for blowing away old symlinks
Diffstat (limited to 'stow/duplicity/.local/bin/backup')
-rwxr-xr-xstow/duplicity/.local/bin/backup27
1 files changed, 27 insertions, 0 deletions
diff --git a/stow/duplicity/.local/bin/backup b/stow/duplicity/.local/bin/backup
new file mode 100755
index 0000000..6324c05
--- /dev/null
+++ b/stow/duplicity/.local/bin/backup
@@ -0,0 +1,27 @@
+#!/bin/bash
+
+set -euo pipefail
+
+set -o allexport
+# shellcheck source=../../.config/duplicity/config
+source ~/.config/duplicity/config
+set +o allexport
+
+source_directory=~
+excludes=~/.config/duplicity/excludes
+target_url=b2://"$B2_KEY_ID"@"$B2_BUCKET"
+
+# take a new full backup every month, incremental otherwise
+duplicity backup --full-if-older-than 1M --exclude-filelist "$excludes" "$source_directory" "$target_url"
+
+# keep 12 months of full backups
+duplicity remove-all-but-n-full 12 --force "$target_url"
+
+# keep 3 months of incremental backups
+duplicity remove-all-inc-of-but-n-full 3 --force "$target_url"
+
+# cleanup
+duplicity cleanup --force "$target_url"
+
+# show collection status
+duplicity collection-status "$target_url"