Skip to content

undaunt/rtb-wrapper

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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"
FLAGS="-D --numeric-ids --links --hard-links --one-file-system --itemize-changes --times --recursive --perms --owner --no-group --stats --human-readable"

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 RTB_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"
# rsync flags if overriding default
FLAGS="-D --numeric-ids --links --hard-links --one-file-system --itemize-changes --times --recursive --perms --owner --no-group --stats --human-readable"
# 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

About

profile based rsync-time-backup wrapper

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 75.0%
  • Dockerfile 13.2%
  • PHP 11.8%