[CentOS] Limiting files when using rsync

Fri Jan 26 05:24:11 UTC 2007
Peter Serwe <peter at infostreet.com>

Todd Cary wrote:
> Mark -
>
> Thanks!  That did it.
>
> /usr/bin/rsync -av --exclude=".*" -e ssh /home/ 192.168.0.22:/home/
> My next step will be to brush the dust off of my Perl book and write a 
> crontab script to backup nightly.
>
> Question: I may not be using the term "backup" absolutely correctly.  
> The destination server is a "standby" server.  This is if the source 
> server fails, all I have to do is change the router to point to the 
> standby server.  These are in a home office and I do not consider 
> myself a system administrator; just someone who knows enough to keep 
> the server running (it's main task is FTPing).  Do you have any 
> suggestions about using rsync as I am doing?
I'm confused *what* in the world would make you want to write perl for this
purpose when two lines of bash would serve the purpose (admirably).

#!/bin/bash
/usr/bin/rsync -av --exclude=".*" -e ssh /home/ 192.168.0.22:/home/

If for some reason, you wanted to do something sexier or more dynamic
in terms of the source/destination, that would add 4 more lines to make it
something like:

#!/bin/bash
for dir in 'ls -1 /home/'
     do
     /usr/bin/rsync -av --exclude=".*" -e ssh /home/$dir/ 
192.168.0.22:/home/$dir/
     done

You can even nest loops and iterate multiple parameters.

Peter

-- 
Peter Serwe <peter at infostreet dot com>

http://www.infostreet.com

"The only true sports are bullfighting, mountain climbing and auto racing." -Earnest Hemingway

"Because everything else requires only one ball." -Unknown

"Do you wanna go fast or suck?" -Mike Kojima

"There are two things no man will admit he cannot do well: drive and make love." -Sir Stirling Moss