PDA

View Full Version : Backuping up to home linux server


jelevin
04-22-2007, 02:58 PM
I wanted to automate my site backup using rsync to my home network. I consider myself pretty experienced and actually use rsync on my home for daily backups.

As far as I can tell, despite some postings of Terra's scatterred around this forum to "just use rsync -essh" it is quite complicated to set this up as securely as possible to run from a home cron script.

I ended up following the excellent instructions at http://troy.jdmz.net/rsync/index.html as closely as I could.

The cron script I plan to run on one of my home machines looks like this:



#!/bin/bash
# Run this script to mirror sections of thelevins.net to local computer coconut
rsync -e "ssh -i /etc/cron.daily/coconut-myusername-rsync-key" -rtpzvv --delete myusername@mydomainname.net:/big/dom/xmydomainname/backups /home/data/backups/mydomainname.net
#

Setting this up requires knowledge of cron, ssh and rsync. I'm sure others would appreciate a step by step instruction including setting file permissions that work for the FQ environment.

Any help?

Kevin
04-22-2007, 03:15 PM
The rsync command I use is:
rsync -vaxSH -essh --progress -z --ignore-errors --delete username@host:/big/dom/xdom/ /backup/dir/

You probably don't have any hard links or sparse files on your FQ account so the -S and the -H aren't really needed but I use rsync for server backups as well so I am used to using them.

jelevin
04-22-2007, 04:19 PM
Thanks, Kevin. Do you have a way to automate this as a cron job? The issue is dealing with the passwords in the scripts.

Kevin
04-22-2007, 04:27 PM
I already had ssh setup to login without a password. I didn't setup an alternate keyfile like you did I just use the standard names (~/.ssh/identity*)

I don't actually do the backups from cron because I normally keep my backup server shutdown and only turn it on when I actually need to run a backup. Then I run the backup scripts manually. There is no reason that it wouldn't work from cron though.