LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 09-18-2012, 10:54 AM   #1
j1renicus
LQ Newbie
 
Registered: Sep 2012
Posts: 2

Rep: Reputation: Disabled
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>
Is this sensible? Content managers want the images copied over to the other web servers within 2 minutes.

I should say that these web servers are on the same LAN.

Last edited by j1renicus; 09-18-2012 at 11:00 AM. Reason: Adding more info.
 
Old 09-18-2012, 12:07 PM   #2
SecretCode
Member
 
Registered: Apr 2011
Location: UK
Distribution: Kubuntu 11.10
Posts: 562

Rep: Reputation: 102Reputation: 102
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.
 
Old 09-19-2012, 03:38 AM   #3
j1renicus
LQ Newbie
 
Registered: Sep 2012
Posts: 2

Original Poster
Rep: Reputation: Disabled
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
rsync solaris + ld.so.1: rsync: fatal: libiconv.so.2: open failed: xxx_anuj_xxx Solaris / OpenSolaris 25 02-23-2012 03:23 AM
[SOLVED] rsync execution issue with crontab - Have given full path to rsync too!! Prabagaran Linux - Server 6 04-15-2011 01:39 AM
Could I run rsync to download files from a server without rsync daemon? Richard.Yang Linux - Software 1 09-18-2009 04:08 AM
How can I use rsync to keep multiple clients in sync? BadTim Linux - Software 17 02-01-2008 04:07 AM
Rsync server vs rsync over ssh humbletech99 Linux - Networking 1 10-18-2006 12:10 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 07:25 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration