Solved

Comparing file date/time stamp between 2 hosts.

Posted on 2000-03-17
7
421 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
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Using libpcap/Jpcap to capture and send packets on Solaris version (10/11) Library used: 1.      Libpcap (http://www.tcpdump.org) Version 1.2 2.      Jpcap(http://netresearch.ics.uci.edu/kfujii/Jpcap/doc/index.html) Version 0.6 Prerequisite: 1.      GCC …
Java performance on Solaris - Managing CPUs There are various resource controls in operating system which directly/indirectly influence the performance of application. one of the most important resource controls is "CPU".   In a multithreaded…
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.:
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.

840 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