-
Hello, My scripts work in the following way: #!/usr/bin/bash
btrfs subvolume snapshot -r /srv/dev-disk-by-label-data/luca/ /srv/dev-disk-by-label-data/.snapshots/srv/dev-disk-by-label-data/luca
echo -e "\n\n~~~~~\n\n"
. /root/restic_envs_passport.sh
echo -e "\n\n\n---\nBACKUP TO: ${RESTIC_REPOSITORY}\n---\n"
/root/bin/restic --verbose backup "/srv/dev-disk-by-label-data/.snapshots/srv/dev-disk-by-label-data" --tag data --exclude-file="/root/backup-exclude.txt"
echo -e "\n---\nDIFF\n---\n"
/root/bin/restic snapshots --json | python -c "import sys, json; j=json.load(sys.stdin); j = [x for x in j if 'tags' not in x or 'fireflyiii' not in x['tags'] or 'actual' not in x['tags']]; print(j[-2]['short_id'] + ' ' + j[-1]['short_id'])" | xargs /root/bin/restic diff
echo -e "\n\n~~~~~\n\n"
btrfs subvolume delete /srv/dev-disk-by-label-data/.snapshots/srv/dev-disk-by-label-data/luca The idea is the following:
I am interested in automating all this with backrest. Any help is much appreciated! 😄 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
Hmm, this is pretty challenging in backrest today -- backrest doesn't support a dynamic path for backup and it looks like restic won't follow symlinks. You'll need a way to mount the btrfs snapshot in a consistent location accessible to backrest. In terms of actually running scripts before/after backup that should be doable with the CONDITION_BACKUP_START and CONDITION_BACKUP_END set on a command hook. |
Beta Was this translation helpful? Give feedback.
I just went ahead and tested this. Works like a charm, this is my main backup plan: