Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Comparing file date/time stamp between 2 hosts.

Posted on 2000-03-17
7
Medium Priority
?
428 Views
Last Modified: 2010-08-05
Any suggestions for comparing file date/time stamp between 2 hosts?  I have to compare like named files (and dirs.) between 2 hosts, and then overlay the older file with a newer file.  I want to avoid ftp'ing or remote copying any unnecessary files between the hosts, and cannot think of how to accomplish this task without doing so.  
Thanks.
0
Comment
Question by:kfleary
7 Comments
 
LVL 40

Expert Comment

by:jlevie
ID: 2628961
Do you have rdist? That's exactly the what rdist is for.
0
 

Author Comment

by:kfleary
ID: 2629055
The problem is that I cannot identify the files on one server as the "master" files?  I literally have to compare the two files for the most current date/time stamp.  Then the newest file will be copied over the the server with the old file.
0
 
LVL 3

Expert Comment

by:kinsey
ID: 2629463
Have you tried using CPIO either through a rsh pipe or a mounted filesystem?
i.e.

cd /data
find . -depth -print|cpio -ov|rsh otherhost "(cd /data;cpio -ivd)"

By default cpio does not copy older files top on newer ones.

Harold
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 21

Expert Comment

by:tfewster
ID: 2629467
Have you considered NFS mounting filesystems between the 2 hosts so you only have a single copy of the file(s)?

Solaris has a command "filesync" that will do what you want, based on rules you define (e.g. what to do if both files have changed from the "baseline"); I'll check to see whether this is available for other Unixes.
0
 

Author Comment

by:kfleary
ID: 2630303
I need to have the files synced on both servers, and one server cannot act as the "master".
0
 
LVL 40

Expert Comment

by:jlevie
ID: 2630639
Okay, that would probably eliminate rdsit from consideration. I can see a couple of other ways to solve the problem. To determine which would be the most appropriate and most efficient I need to know a bit more about the environment. What rights do you have on the remote systems, ordinary login, rsh/rexec? Is installation of safe and well behaved PD tools on the local and remote systems possible?
0
 
LVL 2

Accepted Solution

by:
mapc earned 180 total points
ID: 2631865
Since the obvious solution is writing a script that does it, and I assume that it's not what you're asking for,
I shall recommend using rsync.
This tool does exactly what you need, it allows to keep files in sync, it can use rsh or ssh, or any other remote-shell, it can use compression, it can check timestamp and md5sum and many many more features. Find it at:
http://rsync.samba.org/
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Let's say you need to move the data of a file system from one partition to another. This generally involves dismounting the file system, backing it up to tapes, and restoring it to a new partition. You may also copy the file system from one place to…
Installing FreeBSD… FreeBSD is a darling of an operating system. The stability and usability make it a clear choice for servers and desktops (for the cunning). Savvy?  The Ports collection makes available every popular FOSS application and packag…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.
Suggested Courses
Course of the Month12 days, 7 hours left to enroll

972 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question