backup.sh 608 Bytes
Newer Older
kaiyou's avatar
kaiyou committed
1 2 3 4 5 6 7 8 9 10 11 12 13
#!/usr/bin/env bash

set -e -o pipefail

source /srv/config/backup.config
export RESTIC_REPOSITORY RESTIC_PASSWORD AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY

restic unlock &
wait $!

restic backup \
        --verbose \
        --one-file-system \
kaiyou's avatar
kaiyou committed
14
        --exclude-if-present .nobackup \
kaiyou's avatar
kaiyou committed
15 16 17 18 19 20 21 22 23 24 25 26 27 28
        $BACKUP_PATHS &
wait $!

restic forget \
        --verbose \
        --prune \
        --group-by "paths" \
        --keep-daily $RETENTION_DAYS \
        --keep-weekly $RETENTION_WEEKS \
        --keep-monthly $RETENTION_MONTHS \
        --keep-yearly $RETENTION_YEARS &
wait $!

echo "Backup & cleaning is done."