nixos/home/scripts/backup-home.sh

20 lines
651 B
Bash

#!/usr/bin/env bash
export RESTIC_PASSWORD="gunter.home.2rjus.net"
export RESTIC_REPOSITORY="rest:http://10.69.12.52:8000/gunter.home.2rjus.net"
notify-send -e -t 3000 "Backup started" "Backup of /home/torjus started"
SECONDS=0
restic backup /home/torjus \
--exclude '/home/torjus/.cache' \
--exclude '/home/torjus/.local/share/Steam' \
--exclude '/home/torjus/git/nixpkgs'
retval=$?
if [ $retval -ne 0 ]; then
notify-send -u critical "Backup failed" "Backup of /home/torjus failed"
exit 1
fi
restic forget -d 7 -w 4 -m 6 --prune
notify-send -e -t 3000 "Backup completed" "Backup of /home/torjus completed in $SECONDS seconds."