From 815d878c034a3713ed2f581cfa340db552793d86 Mon Sep 17 00:00:00 2001 From: capntack Date: Sat, 23 Mar 2024 00:47:07 -0500 Subject: [PATCH] Added ability to limit AWS upload speed and connections --- templates/resticTemplate.sh | 28 +++++++++++++++++++++------- templates/variablesAWSTemplate.sh | 2 ++ templates/variablesTemplate.sh | 2 ++ 3 files changed, 25 insertions(+), 7 deletions(-) diff --git a/templates/resticTemplate.sh b/templates/resticTemplate.sh index 3484b54..ae6ddc3 100644 --- a/templates/resticTemplate.sh +++ b/templates/resticTemplate.sh @@ -1,9 +1,23 @@ #!/bin/bash -restic backup --verbose \ - --tag "${RESTIC_TAG_01}" --tag "${RESTIC_TAG_02}" \ - --exclude-caches \ - --exclude-file="${RESTIC_EXCLUDES}" \ - --exclude "${SCRIPT_DIR}"/variables.sh \ - --exclude "${SCRIPT_DIR}"/variablesAWS.sh \ - "${RESTIC_SOURCE}" \ No newline at end of file +if [ AWS_RESTIC_BACKUP = 'no' ]; then + restic backup --verbose \ + --tag "${RESTIC_TAG_01}" --tag "${RESTIC_TAG_02}" \ + --exclude-caches \ + --exclude-file="${RESTIC_EXCLUDES}" \ + --exclude "${SCRIPT_DIR}"/variables.sh \ + --exclude "${SCRIPT_DIR}"/variablesAWS.sh \ + "${RESTIC_SOURCE}" +fi + +if [ AWS_RESTIC_BACKUP = 'yes' ]; then + restic backup --verbose \ + --tag "${RESTIC_TAG_01}" --tag "${RESTIC_TAG_02}" \ + --exclude-caches \ + --exclude-file="${RESTIC_EXCLUDES}" \ + --exclude "${SCRIPT_DIR}"/variables.sh \ + --exclude "${SCRIPT_DIR}"/variablesAWS.sh \ + -o s3.connections="${AWS_CONNECTIONS}" \ + --limit-upload "${AWS_UPLOAD}" \ + "${RESTIC_SOURCE}" +fi \ No newline at end of file diff --git a/templates/variablesAWSTemplate.sh b/templates/variablesAWSTemplate.sh index 0c5e8c5..13af4bd 100644 --- a/templates/variablesAWSTemplate.sh +++ b/templates/variablesAWSTemplate.sh @@ -14,6 +14,8 @@ export RESTIC_REPOSITORY='/path/to/repo' export AWS_ACCESS_KEY_ID='KEY-ID' export AWS_SECRET_ACCESS_KEY='SECRET-KEY' +# readonly AWS_CONNECTIONS='2' +# readonly AWS_UPLOAD='2440' export RESTIC_PASSWORD='PASSWORD' readonly RESTIC_SOURCE='/path/to/dir/to/backup' diff --git a/templates/variablesTemplate.sh b/templates/variablesTemplate.sh index 13e2f50..9c5beef 100644 --- a/templates/variablesTemplate.sh +++ b/templates/variablesTemplate.sh @@ -79,6 +79,8 @@ readonly LOG_RETENTION='30' ## Only set these if backing up to a compatible repo # export AWS_ACCESS_KEY_ID='KEY-ID' # export AWS_SECRET_ACCESS_KEY='SECRET-KEY' +# readonly AWS_CONNECTIONS='2' +# readonly AWS_UPLOAD='2440' ## Set these for all restic configurations # export RESTIC_REPOSITORY='/path/to/repo'