Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Comparing file date/time stamp between 2 hosts.

Posted on 2000-03-17
7
Medium Priority
?
425 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Independent Software Vendors: 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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

Introduction Regular patching is part of a system administrator's tasks. However, many patches require that the system be in single-user mode before they can be installed. A cluster patch in particular can take quite a while to apply if the machine…
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 how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
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.
Suggested Courses

704 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