Add backup script

This commit is contained in:
Torjus Håkestad 2024-03-05 08:47:09 +01:00
parent fc677c6270
commit 5f48a0ab51
2 changed files with 23 additions and 0 deletions

View File

@ -0,0 +1,19 @@
#!/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."

View File

@ -11,4 +11,8 @@
source = ./randomwp.sh;
executable = true;
};
home.file.".local/bin/backup-home" = {
source = ./backup-home.sh;
executable = true;
};
}