Link to home
Start Free TrialLog in
Avatar of pritipatel0408
pritipatel0408

asked on

Sync linux and windows folders across networks.

We have rackspace linux server folder that needs to be mirrored to our local network shared windows folder reliably. What are my options ? The source folder has files from over the years that need to be excluded from during syncing. Only the files newly coming into source folder needs to be mirrored.

The linux folder files are too slow for accessing from corp PC and would like to rather have them accessed from a local shared drive. What is the best way to address this ? Can you help?
ASKER CERTIFIED SOLUTION
Avatar of Justin Stear
Justin Stear
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of pritipatel0408
pritipatel0408

ASKER

I dont know linux, can you please cite an example script that does the above ?
Do you have support with Rackspace?  They might have a program that already does something like this.
I looked at the links you pointed out. Its not clear which flag allows me to specify only newer or amended files need to be mirrored and not a full back up?
To elaborate
Lets say my windows destination folder is currently empty and my source linux folder has files 1.pdf, 2.pdf and 3.pdf. I enable rsync between folders. When I copy 4.pdf in the linux folder. The destination should only have 4.pdf. The older files should remain out.
Rsync will only sync new/modified files.  You can either move the files you don't want sync'd or you will have to pipe commands together to get this to work.

find . -newermt "2015-07-29 15:21:00" -print0 | rsync -vuptn -0 --files-from=- "location"

Open in new window


http://linux.die.net/man/1/rsync

*n* will do a trial run, before actually doing anything, remove it when you are ready.
Great. Will it be like a service that runs does the mirroring in real time? Doing it in real time is important for me. Many thanks!
How much data changes throughout the day?  There may be better solutions than what you are trying to do.
If you want this to run repetitively you will need to setup a cron job to run an rsync script.
The data does not change much. But when a file gets dropped in the source, it should start copying to the destination. it does not have to wait until a set time to start the process.
Here is a post that shows how to setup cron job every minute.
https://bbs.archlinux.org/viewtopic.php?pid=450562#p450562
Would this how the behavior be ? Can you please confirm?

Lets say I start the cron job at set to run every 5 mintures

at 3PM
Source : 1.pdf, 2.pdf, 3.pdf
Destination empty

At 3:01 PM I add a file to the 4.pdf
At 3:05 PM  cronjob results in
Source 1.pdf, 2.pdf, 3.pdf, 4.pdf
Destination 4.pdf

At 3:06 PM
I add 5.pdf and 6.pdf

At 3:10PM I have
source: 1.pdf, 2.pdf, 3.pdf,4.pdf,5.pdf,6.pdf
Destination 3.pdf, 4.pdf, 5.pdf

Is that correct?

Can I not use incron to watch the folder? I wont have any sub folders to sync.
In your example, if you specify to only sync files after 3.pdf, it will never sync 1.pdf 2.pdf or 3.pdf.  it will also sync 6.pdf to the destination.  You can always add more, but it isn't necessary.  I would just experiment on test data and make sure everything works as it is supposed to within your network.  I don't recommend testing on a production server.