aboutsummaryrefslogtreecommitdiff
path: root/stow/duplicity/.local/bin/backup
blob: 6324c05ef28e4227a1112287d3ae5e1a24a32f5c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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"