aboutsummaryrefslogtreecommitdiff
path: root/bin/linux/backup
diff options
context:
space:
mode:
authorMatt Singleton <matt@xcolour.net>2023-02-03 14:39:07 -0600
committerMatt Singleton <matt@xcolour.net>2023-02-03 14:39:07 -0600
commite9dc4c1090abb01317847c417b75d3960f3da34d (patch)
tree2fb84cf24675f1294f9f7a33ea949d514844c6f1 /bin/linux/backup
parent969f76a8238e2d43a25740c8272bf635d436f0d3 (diff)
only install platform-appropriate configs based on uname
Diffstat (limited to 'bin/linux/backup')
-rwxr-xr-xbin/linux/backup27
1 files changed, 27 insertions, 0 deletions
diff --git a/bin/linux/backup b/bin/linux/backup
new file mode 100755
index 0000000..75aded9
--- /dev/null
+++ b/bin/linux/backup
@@ -0,0 +1,27 @@
+#!/bin/bash
+
+set -euo pipefail
+
+set -o allexport
+# shellcheck source=../local/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 --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"