Skip to content

Instantly share code, notes, and snippets.

@russelldavies
Last active January 21, 2021 15:31
Show Gist options
  • Save russelldavies/afb6e7e14eda9443f79d3498fbe8cc83 to your computer and use it in GitHub Desktop.
Save russelldavies/afb6e7e14eda9443f79d3498fbe8cc83 to your computer and use it in GitHub Desktop.
Restic backup script
#!/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"
@Goorzhel
Copy link

Goorzhel commented Jan 5, 2019

Did you mean to write to $RESTIC_PASSWORD twice in a row?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment