mcglnx
December 12th, 2006, 07:19 PM
Dear All,
WARN: the 'delete' parameters may not do you what you want, please read rsync doc to be sure!
Here is a simple script that I found usefull to backup my home dir. It just copies the delta from one dir to the other - While the first call is quite slow, the subsequent ones are very fast.
Using hard links you can even improve this to keep an history without wasting drive space.
I use it so synch my music players, photos backups drive and home dir.
Here is the script. Just copy it to your favorite USB backup drive directory and run it (test first on dummy location if you don't want to loose everything ! ;) ):
#!/bin/sh
EXCLUDES=exclude.list
touch $EXCLUDES
SRC=$HOME
DT=`date`
LOG=/tmp/backup.${DT}.log
# -- Uncomment this line when you know what you do -
# This will delete the files you've been delete on the source as well.
#DO_DELETE="--delete --delete-excluded"
echo "Starting backup of $SRC at $DT. "
rsync -Cav $DO_DELETE \
--exclude-from="$EXCLUDES" \
$SRC . > $LOG
DT=`date`
echo "Done at $DT"
On the same directory I have an exclude.list file containing something like:
*/import/*
*/tmp/*
*/src/*
*/.bochs/*
*/.gnome/*
*/.mozilla/*/Cache/*
*/.mldonkey/*
*/.aMule/*
WARN: the 'delete' parameters may not do you what you want, please read rsync doc to be sure!
Here is a simple script that I found usefull to backup my home dir. It just copies the delta from one dir to the other - While the first call is quite slow, the subsequent ones are very fast.
Using hard links you can even improve this to keep an history without wasting drive space.
I use it so synch my music players, photos backups drive and home dir.
Here is the script. Just copy it to your favorite USB backup drive directory and run it (test first on dummy location if you don't want to loose everything ! ;) ):
#!/bin/sh
EXCLUDES=exclude.list
touch $EXCLUDES
SRC=$HOME
DT=`date`
LOG=/tmp/backup.${DT}.log
# -- Uncomment this line when you know what you do -
# This will delete the files you've been delete on the source as well.
#DO_DELETE="--delete --delete-excluded"
echo "Starting backup of $SRC at $DT. "
rsync -Cav $DO_DELETE \
--exclude-from="$EXCLUDES" \
$SRC . > $LOG
DT=`date`
echo "Done at $DT"
On the same directory I have an exclude.list file containing something like:
*/import/*
*/tmp/*
*/src/*
*/.bochs/*
*/.gnome/*
*/.mozilla/*/Cache/*
*/.mldonkey/*
*/.aMule/*