diff options
author | Matt Singleton <matt@xcolour.net> | 2021-04-29 09:04:46 -0500 |
---|---|---|
committer | Matt Singleton <matt@xcolour.net> | 2021-04-29 09:04:46 -0500 |
commit | 18ec9d907f72d95b0eeb255e9b5f35242f2a4d60 (patch) | |
tree | 1a362be24c98a4cda2b9e1a2cafe90bc5152fae1 /bin/backup | |
parent | 73a7539ede46eba38673b750b8980be4dba141dd (diff) |
duplicity backup scripts
Diffstat (limited to 'bin/backup')
-rwxr-xr-x | bin/backup | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/bin/backup b/bin/backup new file mode 100755 index 0000000..9366322 --- /dev/null +++ b/bin/backup @@ -0,0 +1,27 @@ +#!/usr/bin/env 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" |