]> git.openstreetmap.org Git - chef.git/blob - cookbooks/git/templates/default/backup.cron.erb
Fail backup script on failures
[chef.git] / cookbooks / git / templates / default / backup.cron.erb
1 #!/bin/bash
2
3 # DO NOT EDIT - This file is being maintained by Chef
4 set -euo pipefail
5
6 export ZSTD_CLEVEL=11
7 export ZSTD_NBTHREADS=0
8
9 T=$(mktemp -d -t -p /var/tmp git.XXXXXXXXXX)
10 D=$(date +%Y-%m-%d)
11 B="git-$D.tar.zst"
12
13 ln -s /var/lib/git "$T/git-$D"
14
15 nice tar --create --dereference --directory="$T" --sort=name "git-$D" | nice zstd --quiet --long --rsyncable -o "$T/$B"
16 nice rsync --preallocate --fuzzy "$T/$B" backup.openstreetmap.org::backup
17
18 rm -rf "$T"