24 lines
787 B
Django/Jinja
Executable file
24 lines
787 B
Django/Jinja
Executable file
#!/bin/bash
|
|
set -euo pipefail
|
|
|
|
echo "Starting to export backups..."
|
|
|
|
{% if backup_backend == 'restic' %}
|
|
# restic backend
|
|
source /etc/backup-client/restic.env
|
|
|
|
{% if backups.backends.restic.repo_type == "local" %}
|
|
{% for i in backups.export.destinations if i.type == "rsync" %}
|
|
echo "exporting to {{ i.host }}"
|
|
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 %}
|
|
{% else %}
|
|
echo "Repo is not local. Skipped."
|
|
{% endif %}
|
|
{% endif %}
|
|
|
|
{% if not backup_backend %}
|
|
echo "Noop, backup is handled external"
|
|
{% endif %}
|
|
|
|
echo "done!"
|