From cd7ffa12e4134a88d2e9dcf2c8c7721490778c78 Mon Sep 17 00:00:00 2001 From: trotFunky Date: Sun, 14 Mar 2021 21:04:54 +0000 Subject: [PATCH] Restic : add local copy script, change binary TODO : Change backup script to use environment variables is set, like local copy Local copy script assumes repository already exists. TODO ? Make it create if needed, handle prunes --- VPS/restic-backup.sh | 3 ++- VPS/restic-local-copy.sh | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100755 VPS/restic-local-copy.sh diff --git a/VPS/restic-backup.sh b/VPS/restic-backup.sh index 44c969c..3128457 100755 --- a/VPS/restic-backup.sh +++ b/VPS/restic-backup.sh @@ -1,7 +1,8 @@ #!/bin/bash # Use setcap'd binary in home directory -PATH="/home/restic/bin/:$PATH" +#PATH="/home/restic/bin/:$PATH" +# Now uses binary in /usr/bin, which is also setcap'd backup_origin="/backups/restic" backup_container="central-backup" diff --git a/VPS/restic-local-copy.sh b/VPS/restic-local-copy.sh new file mode 100755 index 0000000..fd51479 --- /dev/null +++ b/VPS/restic-local-copy.sh @@ -0,0 +1,19 @@ +#!/bin/bash +set -euo pipefail + +backup_origin=${backup_origin:-"/backups/restic/"} + +backup_container=${backup_container:-"central-backup"} +local_repository="$backup_container""-local" + +cd "$backup_origin" + +source openrc.sh + +export RESTIC_PASSWORD_FILE="$backup_container".pass +export RESTIC_PASSWORD_FILE2="$local_repository".pass +export RESTIC_REPOSITORY="swift:$backup_container:/restic" +export RESTIC_REPOSITORY2="$backup_origin""$local_repository" + +# Higher connection count seems to help greatly with copy time +restic copy -o swift.connections=100 -vv