[CentOS] Limiting files when using rsync

Fri Jan 26 17:07:02 UTC 2007
Mark Schoonover <schoon at amgt.com>

Todd Cary wrote:
> Mark Schoonover wrote:
>> 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?
>>> 
>>> 
>> 
>> Todd,
>> 
>> 	If all you want to do is mirror the main server to the backup
>> server, your command is almost correct. You'll want to add --delete
>> on the commandline. This will cause rsync to remove any files from
>> the destination before sending them from the source. This will
>> create a mirror of your  main server to your backup server. 
>> 
>> 	You don't need to go to all the overhead of running Perl to crontab
>> this up. Just drop your rsync command into a file, make it
>> executable then add it to root's crontab file. It'll run just fine
>> after that. 
>> 
>> 	One other thing nonrsync related - top posting, and sending HTML to
>> the list. Makes it hard to respond to your questions. Just remember
>> to use text only, and post responses at the bottom of your emails.
>> Things just tread much easier from top to bottom.
>> 
>> Thanks!
>> 
>> Mark Schoonover
>> IS Manager
>> American Geotechnical - California, Nevada and Arizona
>> V-> 858.450.4040 F-> 714.685.3909 C-> 858.472.3816
>> * software development * systems administration * networking *
>> security * 
>> 
>> 
>> 
>> 
>> 
>> _______________________________________________
>> CentOS mailing list
>> CentOS at centos.org
>> http://lists.centos.org/mailman/listinfo/centos
>> 
>> 
>> 
> Mark -
> 
> Yes, the bottom post vs. the top post is a continual problem for me
> since my business accounts ask for top post (almost demand it) and
> Thunderbird does not have an option for each email address as it does
> for email mode.  I'll try to remember to swap it back and forth.
> 
> Concerning the --delete switch, if I use it, will files created by a
> user on the destination server remain?  Though it is a standby server,
> there are times when it is used by staff.
> 
> The main reason I will use Perl is to create the backup files of the
> Interbase databases and then scp (or rsync) them to the other server.
> 
> Many thanks for the tips....
> 
> Todd

Todd,

	I understand about top posting issues. I don't do it all the time,
especially with coworkers and friends. Since we're the only two in the
conversation, we know the history of the email. To someone that's just
started reading our thread, everything will be in order, all they have to do
is to read from top to bottom.

	No, the --delete switch will only delete files from the destination
server. Now, if the destination server is also having files changed, then
rsync is not for you. Rsync is a one way transfer of files, you can't do
bidirectional rsync. For that you'll have to use Unison instead. 

	I do the exact same thing with my  Mysql servers. I used mysqldump
to backup my databases to a directory. Then, using rsync, I copy them all to
an offsite backup server. The --excludes option, also has --includes, or
better yet, --include-files=filestorsync.txt, then put /home/
/interbasebackups, in that .txt file, one per line. That will tell rsync to
grab everything in /home, and /interbasebackups. No need for Perl in this
situation.

	You've really got all the info on the basics of rsync. Now, it's a
matter of just creating test scripts, reading the man page, etc.


Thanks!

Mark Schoonover
IS Manager
American Geotechnical
V: 858-450-4040 - F: 714-685-3909 - C: 858-472-3816

"Stop the Earth!! I want off!!"