add bandwidth limit by default

This commit is contained in:
nd 2021-08-18 13:03:09 +01:00
parent f0a5477790
commit 32f46bdac5
No known key found for this signature in database
GPG key ID: 21B5CD4DEE3670E9
3 changed files with 4 additions and 1 deletions

View file

@ -69,6 +69,8 @@ export:
# type: rsync # type: rsync
# port: 22 # port: 22
# key: "/etc/backup-client/id_ed25519" # key: "/etc/backup-client/id_ed25519"
# Bandwidth limit for upload, 20mbit/s by default
bwlimit: 2500
# Settings to create a remote sftp user. Use this for restic sftp repos # Settings to create a remote sftp user. Use this for restic sftp repos
remote_sftp_user: remote_sftp_user:

View file

@ -28,6 +28,7 @@ backups:
years: 3 years: 3
export: export:
destinations: [] destinations: []
bwlimit: 2500
remote_sftp_user: remote_sftp_user:
name: backup name: backup
host: ~ host: ~

View file

@ -10,7 +10,7 @@ echo "Starting to export backups..."
{% if backups.backends.restic.repo_type == "local" %} {% if backups.backends.restic.repo_type == "local" %}
{% for i in backups.export.destinations if i.type == "rsync" %} {% for i in backups.export.destinations if i.type == "rsync" %}
echo "exporting to {{ i.host }}" echo "exporting to {{ i.host }}"
rsync -h -r -a --append-verify --delete --stats -e "ssh -p {{ i.port|d(22) }} -i {{ i.key|d('/etc/backup-client/id_ed25519') }}" "${RESTIC_REPOSITORY}/" "{{ i.user }}@{{ i.host }}:{{ i.remotepath }}" rsync -h -r -a --append-verify --delete --stats{%if backups.export.bwlimit %} --bwlimit={{ backups.export.bwlimit }}{% endif %} -e "ssh -p {{ i.port|d(22) }} -i {{ i.key|d('/etc/backup-client/id_ed25519') }}" "${RESTIC_REPOSITORY}/" "{{ i.user }}@{{ i.host }}:{{ i.remotepath }}"
{% endfor %} {% endfor %}
{% else %} {% else %}
echo "Repo is not local. Skipped." echo "Repo is not local. Skipped."