Newer
Older
#!/bin/bash
set -euo pipefail
test -f "/etc/backup-client/enabled" || { echo "Standalone backup is disabled"; exit 0; }
{% if backups.hooks.pre_run %}
echo "Running pre_run hooks"
{% for cmd in backups.hooks.pre_run %}
( {{ cmd }} )
{% endfor %}
echo "Hooks done"
{% endif %}
{% if backup_backend == 'restic' %}
# Run restic in subshell to avoid leaking environment to post_run hooks
(
# restic backend
source /etc/backup-client/restic.env
restic backup \
{{ restic_combined_flags }} \
--exclude-caches \
--one-file-system \
--exclude "${RESTIC_REPOSITORY}" \
--exclude-file "/etc/backup-client/exclude_files" \
--files-from "/etc/backup-client/include_files"
)
{% endif %}
{% if not backup_backend %}
echo "Noop, backup is handled external"
{% endif %}