Here is a good example on using "rsync" http://rsync.samba.org/examples.html

I've modified the first one for 7-days incremental backup.

--
Joseph

On 12/02/12 12:21, Randy Westlund wrote:
I've been using rsync to sync binary files, shell scripts, my
workspace, and random user files under my home directory across
multiple machines.  I'm using one server as the master copy, which
makes daily incremental backups of my files to a separate disk with
rsync.  At the moment, I have my sync script set up as a Makefile with
the following targets.  I run this from multiple workstations.

It would be nice to use something as easy as svn, but many of my files
are binary.  Or something like dropbox would be great.  I don't work
from windows, so I don't need a cross-platform solution.

What utilities do you guys use?  Is there a better way to do this?  It
would be nice to move everything to the background, but I've already
clobbered a few files by calling this in the wrong order and might
move the Makefile to an interactive script to protect against that.  I
have to call 'make clobber' after I remove a local file to push that
change to the server, and if I forgot to call 'make get' first, I have
to fix it manually.

-------sync makefile--------
get:
       rsync -azOuvihh --progress -e ssh $(EXCLUDE) \
       --delete \
       $(HOST):$(SERVER_DIR) $(LOCAL_DIR)

put:
       rsync -azOuvihh --progress -e ssh $(EXCLUDE) \
       $(LOCAL_DIR) $(HOST):$(SERVER_DIR)

clobber:
       rsync -azOuvihh --progress -e ssh $(EXCLUDE) \
       --delete \
       $(LOCAL_DIR) $(HOST):$(SERVER_DIR)
------end-------

-------backup script--------
# if files are already there, hard link
# the last lines mark it as complete and move a soft link pointer
rsync -zavi --progress --delete \
 --link-dest=$BACKUP_PATH/current \
 $SOURCE $BACKUP_PATH/backup_part_$DATE \
 && mv $BACKUP_PATH/backup_part_$DATE $BACKUP_PATH/backup_$DATE \
 && unlink $BACKUP_PATH/current \
 && ln -s $BACKUP_PATH/backup_$DATE $BACKUP_PATH/current
-------end---------

Randy


Reply via email to