ansible-setup-backups/templates/backup-send.sh.j2

20 lines
492 B
Django/Jinja

#!/bin/bash
###### Unlock the restic database in case it's locked
$RESTIC --password-file=$PWD_FILE unlock
###### Send backups
date
echo "Sending the backup to the destination..."
{
cat /backup-dirs
sed -e '/^$/d' -e 's|^|--exclude=|' /backup-dirs-exclude
} | xargs -d '\n' $RESTIC --password-file=$PWD_FILE backup
date
echo "Pruning the backup on the destination..."
$RESTIC --password-file=$PWD_FILE forget --prune --keep-daily 3 --keep-weekly 2 --keep-monthly 1 --keep-yearly 1