Add backup script
This commit is contained in:
parent
fc677c6270
commit
5f48a0ab51
19
home/scripts/backup-home.sh
Normal file
19
home/scripts/backup-home.sh
Normal 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."
|
@ -11,4 +11,8 @@
|
||||
source = ./randomwp.sh;
|
||||
executable = true;
|
||||
};
|
||||
home.file.".local/bin/backup-home" = {
|
||||
source = ./backup-home.sh;
|
||||
executable = true;
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user