profile based rsync-time-backup wrapper
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
test
.gitignore
.travis.yml
LICENSE
README.md
rtb-wrapper.sh
run-tests.sh

README.md

rtb-wrapper - declarative rsync-time-backup Build Status

You know and love the well known rsync-time-backup from Laurent Cozic aka laurent22! Now what could be missing since this is a mature project? The whole thing based on separate profile files per backup case!

Example:

Consider this example profile (named user1-documents.inc):

SOURCE="${HOME}/Documents"
TARGET="/mnt/backup-disk/Documents"
EXCLUDE_FILE="/home/user1/opt/backup-documents-excludes.lst"

Now it's as easy as this to backup our data:

rtb-wrapper.sh backup user1-documents 

And here is how to restore from the latest backup:

rtb-wrapper.sh restore user1-documents

Requirements

Setup

# prepare the profile folder
mkdir -p "${HOME}/.rsync_tmbackup/conf.d"
# download the script
curl -Lo "/usr/local/bin/rtb-wrapper.sh" "https://raw.githubusercontent.com/thomas-mc-work/rtb-wrapper/master/rtb-wrapper.sh"
# mark the script executable
chmod +x "/usr/local/bin/rtb-wrapper.sh"

Configuration

rtb-wrapper is using $HOME/.rsync_tmbackup as the base config folder, except it's overridden by the environment variable CONFIG_DIR.

Profile file

$HOME/.rsync_tmbackup/conf.d/<profile-name>.inc: The backup profiles, one per file

# the source folder
SOURCE="${HOME}/Documents"
# the target folder
TARGET="/media/user1/backup-disk/Documents"
# optional: the exclude file for rsync
EXCLUDE_FILE="${HOME}/backup-documents-excludes.lst"
# optional: wipe the source folder before restoring files? (true/false; default: false)
WIPE_SOURCE_ON_RESTORE=true

Exclude file

Alternatively you can define the exlcude file also by placing it next to the profile file. Following the convention:

${HOME}/.rsync-tmbackup/conf.d/<profile-name>.inc
${HOME}/.rsync-tmbackup/conf.d/<profile-name>.excludes.lst

This exclude file definition will be overriden by the definition within the profile.

Development

Testing

There are some tests written with bats to verify your changes:

./run-tests.sh