I have two identical redhat 8 servers(for web server), I try to synchronize these two machines to keep web document files same as the other one. how can I do that?
I have no idea how to use "rsync-2.5.5-1.i386", can anyone help me? many thanks.
Here's a script I'm pretty proud of. It relies on you exchanging a key with the source server (see SSH articles above). Then you invoke this script on a cron'd schedule.
Adjust directories to suit your needs.
What is particularly key about this invocation of rsync is that it is going to preserve the source file tree (folder hierarchy) when it writes into the current directory (the "." at the end of the line). It deletes on the destination those files/folders that no longer appear on the source. In short, it perfectly duplicates files and folders. I DID NOT pay a great deal of attention to file timestamps nor permissions retention, I'll leave that to you..... I have logging enabled for my own reasons, mainly to keep cron happy.
The first time you run this will take the most time. Afterwards, it should quickly slip into "incremental" maintenance of the sync and you should't have a great deal of time spent making the sync.
====filename: backup_web.example.com.sh===============
#!/bin/sh
HOSTNAME="web.example.com"
cd /var/backup/$HOSTNAME
I tried to use rsync to synchronize two servers, but when I use command "rsync user@host:/path to folder/ /dest folder/", each time I have to manually enter password, it's impossible to run at crond, can I add password in rsync command line so it won't prompt again?
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.