LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 02-06-2013, 04:31 PM   #1
mat3j
LQ Newbie
 
Registered: Feb 2013
Posts: 4

Rep: Reputation: Disabled
Best daemon/program for keeping directories synchronised?


Hello!

The goal is simple: have /home/user/directoryONE always synced with /home/user/directoryTWO with an interval around 10 seconds. Keep in mind though that there are a lot of subdirectories and files in directoryONE, so some kind of caching would be nice.

Any ideas?
 
Old 02-06-2013, 04:37 PM   #2
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
Quote:
Originally Posted by mat3j View Post
Hello!

The goal is simple: have /home/user/directoryONE always synced with /home/user/directoryTWO with an interval around 10 seconds.

Any ideas?
Yeah, lower your expectation of 'interval'.
 
Old 02-06-2013, 04:47 PM   #3
mat3j
LQ Newbie
 
Registered: Feb 2013
Posts: 4

Original Poster
Rep: Reputation: Disabled
np, just looking for suggestions.
 
Old 02-06-2013, 05:54 PM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
rsync ?
It figures out the diffs between src & target and only txfrs diffs, so after the initial copy (which you could just use cp for), its pretty quick unless you change a LOT of stuff quickly.
 
Old 02-06-2013, 05:57 PM   #5
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
are you familiar with rsync?

or now "what he said".

Last edited by Habitual; 02-06-2013 at 05:59 PM.
 
Old 02-06-2013, 05:58 PM   #6
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
me or the op?
 
Old 02-07-2013, 04:52 AM   #7
mat3j
LQ Newbie
 
Registered: Feb 2013
Posts: 4

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by chrism01 View Post
rsync ?
It figures out the diffs between src & target and only txfrs diffs, so after the initial copy (which you could just use cp for), its pretty quick unless you change a LOT of stuff quickly.
Though rsync may be part of a solution, it's not a whole solution.
 
Old 02-07-2013, 09:24 AM   #8
gdejonge
Member
 
Registered: Aug 2010
Location: Netherlands
Distribution: Kubuntu, Debian, Suse, Slackware
Posts: 317

Rep: Reputation: 73
Quote:
Originally Posted by mat3j View Post
Though rsync may be part of a solution, it's not a whole solution.
That's correct. But it is not the complete solution, because you didn't tell us what the complete problem was.
You had already figured out your "solution" and asked us how to implement it.

Maybe if you told us why you need to sync two directories with an interval of ~10sec. And what kind / amount of data we're talking about. And how often this data changes.
Maybe then we could help you to find a complete solution.
 
Old 02-07-2013, 09:43 AM   #9
mat3j
LQ Newbie
 
Registered: Feb 2013
Posts: 4

Original Poster
Rep: Reputation: Disabled
ok, here are the numbers

Size: ~ 400 MB.
Number of files: ~ 25'000
Number of directories: ~ 3'000

Changes in /home/user/directoryONE are usually small, less than a few MB, though the update interval must be less than 1 minute.
 
Old 02-07-2013, 10:13 AM   #10
whizje
Member
 
Registered: Sep 2008
Location: The Netherlands
Distribution: Slackware64 current
Posts: 594

Rep: Reputation: 141Reputation: 141
You could use lsyncd.
 
Old 02-07-2013, 10:49 AM   #11
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
Quote:
Originally Posted by chrism01 View Post
me or the op?
the OP.
 
Old 02-07-2013, 01:07 PM   #12
Philip Lacroix
Member
 
Registered: Jun 2012
Distribution: Slackware
Posts: 441

Rep: Reputation: 574Reputation: 574Reputation: 574Reputation: 574Reputation: 574Reputation: 574
Unison could also be interesting, it can handle bi-directional syncronization as well.

http://www.cis.upenn.edu/~bcpierce/unison/
http://www.cis.upenn.edu/~bcpierce/u...on-manual.html

Philip
 
Old 02-07-2013, 07:24 PM   #13
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
I agree with whizje, given the extra information. http://linux.die.net/man/1/lsyncd looks like the solution.

It depends on exactly why you are doing this. If you are worried about HW failure, I'd go with RAID1 (or 5 or 6).
 
Old 02-08-2013, 12:28 AM   #14
whizje
Member
 
Registered: Sep 2008
Location: The Netherlands
Distribution: Slackware64 current
Posts: 594

Rep: Reputation: 141Reputation: 141
My first thought was also a raid 1, why do you want to sync those dirs?
 
Old 02-15-2013, 09:10 AM   #15
schwing
LQ Newbie
 
Registered: Oct 2003
Location: Michigan, USA
Distribution: YellowDogLinux & Debian Sarge
Posts: 14

Rep: Reputation: 0
I second the recommendation by whizje. Use lsyncd. I use it in a server environment to keep 3 servers in sync. It uses inotify to watch for new/changed inodes and then fires off rsync to copy those over. If I remember right, it has about a 15 second lag, but it should be pretty close to what you need.

https://code.google.com/p/lsyncd/
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] How to mv while keeping matching sub-directories MisterBark Linux - General 8 07-25-2012 11:34 AM
Need help keeping program alive while killing remote session. jbo5112 Linux - Software 4 05-16-2009 06:49 AM
Keeping a program running between SSH sessions ark86 Linux - Newbie 2 10-01-2005 03:31 PM
a need simple a program to resize images while keeping the aspect ratio Necronomicom Linux - Software 3 07-10-2004 12:21 AM
Is there a way of uninstalling Mozilla but keeping the email program? petercool General 8 06-15-2004 08:46 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

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

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