[ale] rsync --delete and initating backups questions

Charles Brian Quinn me at seebq.com
Mon Jan 30 00:14:20 EST 2006


Hi Alers,

Before I set my rsync backup scripts in motion, I just wanted to ask a 
quick question.

I always get nervous when I see a command with the --delete flag, 
especially when it's going to be run on my web-site, and everything dear 
to me.

So, I've setup .ssh keys for the "backup" user on both my colocated 
server, and a server at home (my mythtv server with a dynamic dns 
entry).  So I can ssh/scp back and forth without any passwords.

Here is my rsync_backup.sh I'm planning on running:

-------
#!/bin/bash
# an rysnc backup script
# invoked by /etc/cron.daily/rsyncbackupcronjob.sh

ssh="/usr/bin/ssh"
sshkey="/home/backup/.ssh/id_dsa"
rsync="/usr/bin/rsync"
rsync_opts=" --delete --compress --archive "
sshadd="/usr/bin/ssh-add"
backup_host="xxxxxx.homelinux.com"

directories_to_backup="/var/www/xxxxxx/htdocs /var/www/xxxxxx /home/xxxxxx"

for dir in $directories_to_backup; do
    # copy a directory to the backup server
    $rsync $rsync_opts -e "$ssh -i $sshkey" $dir 
backup@$backup_host:backups/
done
------------

Now, here's the thing that worries me.  These two directories will be 
kept in "sync" right?  So does it matter which one initiates?  For 
instance, the first time, it would be a lot faster to initiate from the 
home machine (the cable modem has a faster download than upload) -- of 
course I'd have to change around who was copying and from who, but after 
that, can it be setup to be a cron job on the "remote" server, assuming 
the directories are swapped around?  Is there a benefit to running it on 
one versus the other?

My other concern stems from the --delete flag.  If the dates on those 
servers drift, it would not be wise to initiate (do it the first time) 
from one server, and then run the job on the other, right?

I'll be documenting my final setup and will post to the list when it's up.

Thanks,
-- 
Charles Brian Quinn
www.seebq.com





More information about the Ale mailing list