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 12-29-2012, 03:52 AM   #1
shaik_rafi2009
LQ Newbie
 
Registered: Nov 2009
Posts: 11

Rep: Reputation: 0
Cronjob


Iam using 2 Redhat linux 5.8 servers with a Tomcat application, I run a cronjob for directory replication from A server to B server with rsync. Now the problem is i need to execute this cronjob when the B server directory modified or A server modified.

Thanks
Rafi

Last edited by shaik_rafi2009; 12-29-2012 at 04:00 AM.
 
Old 12-29-2012, 07:45 AM   #2
divyashree
Senior Member
 
Registered: Apr 2007
Location: bbsr,orissa,India
Distribution: RHEL5 ,RHEL4,CENT OS5,FEDORA,UBUNTU
Posts: 1,347

Rep: Reputation: 135Reputation: 135
From A and B which is your master ? You should run the cronjob in the master server, which is easy to detect the modification and then run rsync to replicate. But you can run the cronjob in any system as the cronjob runs at particular interval and your cron script should be modified to work like that.
 
Old 12-29-2012, 09:23 AM   #3
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 2,020

Rep: Reputation: 518Reputation: 518Reputation: 518Reputation: 518Reputation: 518Reputation: 518
And if you are trying to do distributed servers on the cheap, then use a filesystem (gluster) to do that instead.

You can't have two master file servers and use rsync to distribute the modifications... No matter what you do, one or the other will delete/overwrite files you don't want destroyed. These are known race conditions that can't be easily fixed.
 
Old 12-31-2012, 09:56 AM   #4
shaik_rafi2009
LQ Newbie
 
Registered: Nov 2009
Posts: 11

Original Poster
Rep: Reputation: 0
Can anyone know configuration of inotify-tools with rsync. Is this helpful replication between servers.
 
Old 12-31-2012, 10:57 AM   #5
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 2,020

Rep: Reputation: 518Reputation: 518Reputation: 518Reputation: 518Reputation: 518Reputation: 518
only from master to slave.

One of the problems with inotify is that it doesn't scale well. It is designed to watch single files/single directories. When you try to add an entire filesystem, you have to have it watch every single file and directory in the filesystem. And that just doesn't work well.

That is why I recommend using a distributed filesystem, and one that is designed for that.

The major problem is trying use parallel distributed use - inotify cannot cover race conditions. It wasn't designed for that.

I recommend gluster for its ease of configuration though I haven't used it myself (single server system). I have used luster which it is based on. Luster uses a master/slave metadata server to resolve race conditions. The actual data is stored/replicated among multiple servers. When a luster based storage cluster boots, each node joing the group becomes a slave - the startup node (first one up I think) becomes the designated master.

Last edited by jpollard; 12-31-2012 at 11:03 AM. Reason: fixing paragraphing error.
 
Old 01-01-2013, 02:36 AM   #6
shaik_rafi2009
LQ Newbie
 
Registered: Nov 2009
Posts: 11

Original Poster
Rep: Reputation: 0
I will try distributed filesystem, Thanks to jpollard and divyasree.
 
Old 01-02-2013, 07:30 PM   #7
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.5, Centos 5.10
Posts: 16,226

Rep: Reputation: 2023Reputation: 2023Reputation: 2023Reputation: 2023Reputation: 2023Reputation: 2023Reputation: 2023Reputation: 2023Reputation: 2023Reputation: 2023Reputation: 2023
It sounds like you want to sync 2 systems bi-directionally, in which case have a look at unison http://linux.die.net/Mobile-Guide/mo...transport.html Sect 15.4.2.3.
 
Old 01-03-2013, 06:39 AM   #8
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 2,020

Rep: Reputation: 518Reputation: 518Reputation: 518Reputation: 518Reputation: 518Reputation: 518
Unison is a manual process ("Conflicting updates are detected and displayed.") and is too slow for web servers anyway. It doesn't look like it can handle updates while it is running either.

Last edited by jpollard; 01-03-2013 at 06:42 AM.
 
Old 01-07-2013, 08:44 AM   #9
shaik_rafi2009
LQ Newbie
 
Registered: Nov 2009
Posts: 11

Original Poster
Rep: Reputation: 0
Thanks to all, I added rsync in cronjob which will run every 15min on both servers. Its working fine now.

Last edited by shaik_rafi2009; 01-07-2013 at 08:47 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
CronJob jboy4 Linux - Newbie 3 02-27-2012 05:03 PM
cronjob help LinuxNeo Linux - Newbie 6 10-13-2010 10:54 PM
Cronjob..... milindpk Linux - Newbie 6 05-06-2010 06:52 PM
cronjob dnaqvi Linux - General 5 04-26-2010 04:05 AM
Cronjob engnet Linux - Networking 6 03-03-2004 09:21 AM


All times are GMT -5. The time now is 10:06 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration