kapott

incremental_backup.sh

Jan 9th, 2019
385
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.67 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. # Set it up creating an empty $TARGET and symlink a dummy $TARGET/latest to it. Populate /etc/backup/rsync.exclude with lost+found, tmp, var/run and everything else you need to skip during backup, or go for --include-from if it fits you better; man rsync is your friend.
  4. # Proper sanity checks, error control, remote backup and pretty GNOME GUI are left as an exercise to the reader ;-)
  5.  
  6. DATE=`/bin/date +%Y%m%d%H%M%S`
  7. RSYNC=/usr/bin/rsync
  8. BASE=/mnt/externalhd
  9. TARGET=$BASE/daily
  10. $RSYNC -av --exclude $TARGET --exclude-from=/etc/backup/rsync.exclude --link-dest=$TARGET/latest/ / $TARGET/$DATE/
  11. touch $TARGET/$DATE/
  12. rm $TARGET/latest
  13. ln -s $TARGET/$DATE $TARGET/latest
Advertisement
Add Comment
Please, Sign In to add comment