Solved

Comparing file date/time stamp between 2 hosts.

Posted on 2000-03-17
7
410 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 20

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 60 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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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…
Why Shell Scripting? Shell scripting is a powerful method of accessing UNIX systems and it is very flexible. Shell scripts are required when we want to execute a sequence of commands in Unix flavored operating systems. “Shell” is the command line i…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

758 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now