[Techtalk] rsync backup script

Kathryn Hogg kjh at flyballdogs.com
Tue Jun 22 08:23:49 EST 2004


Much like Akkana I use rsync to keep my development website in sync with
the published site.  I may make changes on a couple of differenty systems
so before I start editing I use rsync to fetch differences from the public
site and bring them back to the my local mirror.  I make changes then
publish them using rsync.

I generally wrap these into 2 scripts, fetch and publish so making changes
to one of my websites involves:

1. fetch
2. edit
3. publish

Heres the main thing from fetch:

                                                                                rsync
-avz
-e
"ssh
$SSH_ARGS"
--delete
--delete-excluded
--exclude='*~'
\
    $SSH_HOST:footy $DOCROOT

and publish:
rsync $* -avz -e "ssh $SSH_ARGS" --delete --exclude='*~' \
  --exclude analog_stats.html \
  --exclude private/ \
  --exclude 'core*' \
  $DOCROOT $SSH_HOST:

There is one other neat thing I do with rsync.  One website that I help
admin, I don't host.  There is a section of the web site that is kind of
separate and we don't want the admin for that having access to the whole
site.  So I set him up with an ftp account on my system and a cgi script
that calls rsync to push files to the public webserver.

-- 
Kathryn
http://womensfooty.com



More information about the Techtalk mailing list