best way to periodically rsync to clients from rsync server
Hi
We are using rsync to sync a directory containing images on some webservers. I'm after some advice on whether the method I've implemented is appropriate. I have the rsync daemon running on the master web server (where the images are placed/updated by content managers). The command "rsync --daemon" is in rc.local to start the rsync daemon when the server starts. On the client webservers, I have added a cron job to the crontab file as follows: Code:
*/2 * * * * rsync -rqt -<options> <user>@<server>::<path> /<target>/<directory> I should say that these web servers are on the same LAN. |
Looks OK to me. I'd be tempted to look for a change-driven approach based on something like inotify - do nothing until a change in the source folder is detected, then run the rsync command within say 30 seconds. But unless there's a simple scriptable package to do this I wouldn't worry about it.
You might want to add -p to preserve permissions, as these are generally important on web servers. But no need to bother about -o for owners. What about deleting files from the target that have been deleted on the source? Using the --delete option. Probably best not to test this until you've confirmed the basic command is OK! In fact, it will be important to test that the command does the right thing and performs reasonably before committing it to cron. |
Great, thanks for looking.
I've added --delete to the command - thanks for the suggestion I must have been asleep yesterday! I have tested that the command performs as expected and everything seems to be working well. Thanks for the help. |
All times are GMT -5. The time now is 04:25 AM. |