No description
Find a file
Robert Bruce Park 12deac25d6 Correctly handle most recent backup if it's older than 24hs.
Code was assuming that you'd run backups hourly, eg, so you'd have
many backups within the last 24 hours. Code assumed that by the time
you found a backup more than 24h old, you'd already have a value for
$prev set. In the event that your most recent backup is more than 24
hours old, $prev would not be set and bash would get an error "unary
operator expected" when it tried to compare the day of the newest
backup to the empty $prev value.

I fix this by setting a default value for $prev, one that cannot be
mistaken for an existing backup because it does not represent a valid
date. This ensures that the most recent backup is correctly preserved
regardless of it's age.
2013-11-14 19:31:22 -08:00
README.md Rebase on master. 2013-11-13 09:16:31 -08:00
rsync_tmbackup.sh Correctly handle most recent backup if it's older than 24hs. 2013-11-14 19:31:22 -08:00

Rsync time backup

Time Machine style backup with rsync. Should work on Linux, Mac OS X and Windows with Cygwin.

Installation

git clone https://github.com/laurent22/rsync-time-backup

Usage

rsync_tmbackup.sh <source> <destination> [excluded-pattern-path]

Examples

  • Backup the home folder to backup_drive

      rsync_tmbackup.sh /home /mnt/backup_drive  
    
  • Backup with exclusion list:

      rsync_tmbackup.sh /home /mnt/backup_drive excluded_patterns.txt
    

Exclude file

An optional exclude file can be provided as a third parameter. It should be compabible with the --exclude-from parameter of rsync. See [this tutorial] (https://sites.google.com/site/rsync2u/home/rsync-tutorial/the-exclude-from-option) for more information.

Features

  • Each backup is on its own folder named after the current timestamp. Files can be copied and restored directly, without any intermediate tool.

  • Files that haven't changed from one backup to the next are hard-linked to the previous backup so take very little extra space.

  • Safety check - the backup will only happen if the destination has explicitely been marked as a backup destination.

  • Resume feature - if a backup has failed or was interrupted, the tool will resume from there on the next backup.

  • Exclude file - support for pattern-based exclusion via the --exclude-from rsync parameter.

  • The application is one bash script that can be easily edited.

TODO

  • Minor changes (see TODO comments in the source).

LICENSE

MIT

Bitdeli Badge