[Discuss] Backup Scripts / Software
John Blomfield
jabfield at shaw.ca
Thu Nov 13 10:54:13 PST 2014
Now that I have reverted to backup strategies and the ext4 file system
and decided to consider BTRFS at some future time when I understand how
best to use it reliably; I have been upgrading my backup software. I
have been using cron job RSYNC scripts plus some KDialog popup dialogs
to accomplish my daily, weekly and monthly backups and I came across the
following example from the http://rsync.samba.org/examples.html site
that I thought might be of interest to others.
backup to a central backup server with 7 day incremental
#!/bin/sh
# This script does personal backups to a rsync backup server. You will
end up
# with a 7 day rotating incremental backup. The incrementals will go
# into subdirectories named after the day of the week, and the current
# full backup goes into a directory called "current"
# tridge at linuxcare.com
# directory to backup
BDIR=/home/$USER
# excludes file - this contains a wildcard pattern per line of files to
exclude
EXCLUDES=$HOME/cron/excludes
# the name of the backup machine
BSERVER=owl
# your password on the backup server
export RSYNC_PASSWORD=XXXXXX
########################################################################
BACKUPDIR=`date +%A`
OPTS="--force --ignore-errors --delete-excluded --exclude-from=$EXCLUDES
--delete --backup --backup-dir=/$BACKUPDIR -a"
export PATH=$PATH:/bin:/usr/bin:/usr/local/bin
# the following line clears the last weeks incremental directory
[ -d $HOME/emptydir ] || mkdir $HOME/emptydir
rsync --delete -a $HOME/emptydir/ $BSERVER::$USER/$BACKUPDIR/
rmdir $HOME/emptydir
# now the actual transfer
rsync $OPTS $BDIR $BSERVER::$USER/current
###########################################################################
I thought the this was a neat concept so I have adopted it for my design
of a Qt4/C++ GUI program that provides me with better popups to provide
me with constant feedback on backup progress. A backup can sometime take
a long time and I like to know what's happening at any particular
moment, if any errors are occurring and what they are. Instead of the 7
day rotation used in the above script I have generalized it to store
backup changes for any number (eg 10, 19, 33, anything) of backup
occurrences. My GUi is now up and running as a field trial. I just have
to clean up the code and perhaps design a configuration UI rather than
manually modify the code to change backup occurrences and target
directories. The program is not your typical GUI since it must run
automatically under cron with no user interaction hence the
configuration UI must be run separately from the cron job.
I have also put launchers on my desktop so that one click starts a
backup locally or to external backup drive.
I was also inspired to adopt the above approach by the Dropbox web
facility that provides you with a list of past snapshots enabling you to
recover old versions of files. The rotating backups above are
essentially snapshots of past changes. Some may think the above bash
script is quite adequate for job but I just love visual GUI feedback.
John
--
John Blomfield
Delivered by Thunderbird Email on Linux OpenSuse-KDE4
Old John B's Linux Notes http://www.oldjohnbslinux.wordpress.com
More information about the Discuss
mailing list