Simple rsync guide

It amazing me how little I know when I set about tasks. So I’ve got a folder on one web server (the dev box) and I want it to update a folder on another server (the live site). In the verge of writing a script to do it, I’m told “why don’t you just use rsync?”. Yes indeed, why not.

So then. I need to to it over ssh do the -e flag needs telling that. Plus we’re essentially archiving so the -a flag brings together the -rlptgoD functionality (recurse, links, permissions, times, groups, owners, devices). Add in -v to show what it’s up to, and -z to compress the data, hopefully speeding things up and we’re left with something like:

rsync -e ssh -avzn /path/to/source username@serveraddress:/path/to/source

And this produces the error:
ssh: connect to host xx.x.xx.xxx port 22: Connection refused

Ah, well, yes. I think there firewall isn’t configured in that direction. So I’ll try it the other way round on the destination server.

Yes, it works, yay! :)

Technorati Tags: ,