Last active
January 21, 2021 15:31
-
-
Save russelldavies/afb6e7e14eda9443f79d3498fbe8cc83 to your computer and use it in GitHub Desktop.
Restic backup script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
if [ $# -lt 4 ]; then | |
echo $0: Missing arguments | |
echo usage: $0 repo password aws_access_key aws_secret_key | |
exit 1 | |
fi | |
export RESTIC_PASSWORD=$1 | |
export RESTIC_PASSWORD=$2 | |
export AWS_ACCESS_KEY_ID=$3 | |
export AWS_SECRET_ACCESS_KEY=$4 | |
restic backup ~ \ | |
--one-file-system \ | |
--exclude-caches \ | |
--exclude "$HOME/Applications" \ | |
--exclude "$HOME/Downloads" \ | |
--exclude "$HOME/Library" \ | |
--exclude "$HOME/.Trash" \ | |
|| noti -t "Restic Backup" -m "Failed to backup" | |
restic forget \ | |
--keep-hourly 12 \ | |
--keep-daily 7 \ | |
--keep-weekly 5 \ | |
--keep-monthly 6 \ | |
--prune \ | |
|| noti -t "Restic Backup" -m "Failed to prune" | |
restic check \ | |
--with-cache \ | |
|| noti -t "Restic Backup" -m "Check failed" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Did you mean to write to $RESTIC_PASSWORD twice in a row?