Skip to content

Instantly share code, notes, and snippets.

@alhoo
Last active April 21, 2019 10:15
Show Gist options
  • Save alhoo/26c1321f14e2c3550ac40067f367a7e5 to your computer and use it in GitHub Desktop.
Save alhoo/26c1321f14e2c3550ac40067f367a7e5 to your computer and use it in GitHub Desktop.
$ cat bin/backups.sh
#!/usr/bin/env bash
# sudo apt-get install rdiff-backup
BACKUPS="$HOME/backups"
rdiff-backup --exclude $BACKUPS \
--exclude $HOME/VirtualBox\ VMs \
--exclude $HOME/Downloads \
$HOME $BACKUPS
if [ $(df -h $BACKUPS|grep -Po "([0-9]+)(?=%)") -gt 66 ]; then
# Remove old backups if we do not have a lot of space
rdiff-backup --remove-older-than 20W $BACKUPS
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment