LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-31-2012, 06:50 AM   #1
mannoj87
LQ Newbie
 
Registered: Apr 2012
Posts: 9

Rep: Reputation: Disabled
how to can I rsync files frequently upon regular intervals from one server to another


how to can I rsync files frequently upon regular intervals from one server to another?? Whenever file A is updated on server1 the file should reflect its changes on server2 immediately. Is there a way or I should go only with "rsync -t file_a 192.168.21.7:/tmp/ " and put in cron to update every minute?

Last edited by mannoj87; 05-31-2012 at 07:00 AM. Reason: to specifiy clearly
 
Old 05-31-2012, 06:58 AM   #2
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and Scientific Linux
Posts: 5,753

Rep: Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288
Hi,

that question screams for the answer "cron". Try putting "cron tutorial" or "cron howto" into your favourite search engine.

Assuming you are using rsync over ssh, you'll probably also want to setup private/public key based authentication (without a passphrase). There are plenty of howtos on this topic too.

Have a read and let us know how you get on.

Cheers,

Evo2.
 
Old 05-31-2012, 07:16 AM   #3
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 9,349

Rep: Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750
I think there is no way to automatically sync server2 any time when something has changed on server1 immediately, but surely you can white a small script to sync and configure cron to start it in every minute/second/hour...
 
Old 05-31-2012, 08:20 AM   #4
rizzy
Member
 
Registered: Mar 2004
Distribution: Debian
Posts: 283

Rep: Reputation: 68
i've not tried it myself, just an idea. Using watch or inotify tools to monitor a folder/file for changes, execute a script on trigger (rsync).
http://en.wikipedia.org/wiki/Inotify
http://linux.die.net/man/1/watch
 
Old 06-01-2012, 01:28 AM   #5
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and Scientific Linux
Posts: 5,753

Rep: Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288
Indeed, if the OP had asked to run the rsync when files were updated I would have suggested incron, but since the query was about regular time intervals cron seemed to be the obvious answer.

Evo2.
 
1 members found this post helpful.
Old 06-01-2012, 01:54 AM   #6
mannoj87
LQ Newbie
 
Registered: Apr 2012
Posts: 9

Original Poster
Rep: Reputation: Disabled
incron seems to be a better one for now. Though it uses rsync again, but this helps me to update the destination host whenever the file is written on source. This works with the help of <file_change_mask> option - in incron IN_CLOSE_WRITE, IN_MODIFY . Looks cool !! Thanks for your suggestion Evo

Last edited by mannoj87; 06-01-2012 at 01:55 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Selecting files in regular intervals from a folder rpd25 Programming 4 01-30-2012 04:39 AM
rsync "skipping non-regular files" with --archive option andrewtblake Linux - Server 2 04-29-2010 04:15 PM
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 do I schedule a userspace application to run at regular intervals AustinMarton Linux - Software 4 08-05-2009 12:22 AM
mailing myself at regular intervals... piyushiitk Programming 4 08-21-2005 10:26 AM


All times are GMT -5. The time now is 04:10 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration