I use the following command to sync the home directory on the two computers, however I would like not to send the "dot" files e.g. ".ssh". Can that be done, and if so, how would I construct the command line? /usr/bin/rsync -av -e ssh /home/ 192.168.0.22:/home/ Many thanks.... Todd -- Ariste Software 2200 D Street Ext Petaluma, CA 94952 (707) 773-4523
Todd Cary wrote:> I use the following command to sync the home directory on the two > computers, however I would like not to send the "dot" files e.g. > ".ssh". Can that be done, and if so, how would I construct the > command line? > > /usr/bin/rsync -av -e ssh /home/ 192.168.0.22:/home/ > > Many thanks.... > > ToddTodd, I'm pretty sure you need to --exclude '.*' on the command line, buh I usually put all my excludes in a file and --exclude-from=rsync.excludes. 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!!"
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 *
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.... > > ToddTodd, 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!!"
Peter Serwe 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? > 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. > > PeterPeter, Was this just an example of using a for loop?? I wouldn't do this with rsync, it can handle recursive directories on its own. Putting it in a for loop, then calling rsync over and over again, will take a huge performance hit because rsync will have to build the file list for each directory in /home. Just point it to /home, and all will be fine. 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!!"