Skip to content

Instantly share code, notes, and snippets.

@mrysav
Created February 11, 2020 14:27
Show Gist options
  • Select an option

  • Save mrysav/f1948d148f3cfc7ede9e360c90ef7435 to your computer and use it in GitHub Desktop.

Select an option

Save mrysav/f1948d148f3cfc7ede9e360c90ef7435 to your computer and use it in GitHub Desktop.
Restic Backup Script
#!/bin/bash
# not needed if using packaged version
restic self-update
# Assumes you have RESTIC_REPOSITORY and RESTIC_PASSWORD_COMMAND set
# Refresh credentials here, if applicable
# Bail if restic is already running, maybe previous run didn't finish
if pidof -x restic >/dev/null; then
echo "Backup already running"
exit
fi
restic --verbose backup ~/ --exclude-file="$HOME/.restic_excludes"
restic forget --keep-weekly 4 --prune
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment