Operating System - HP-UX
1821410 Members
2944 Online
109633 Solutions
New Discussion юеВ

How to compare files/folders on two different servers?

 
yyghp
Super Advisor

How to compare files/folders on two different servers?

I need to maintain the codes in between our development server and production server, I have to make sure a special folder are synchronized with each other.
How can I compare the folder and all files and folders under that, on two different servers? ( Now, I don't want to just copy files from one server to the other to make them same. ), any good tools on Unix for comparison? such as file size, timestamp, etc...
And is there any good tool for future synchronization?
Thanks!
8 REPLIES 8
yyghp
Super Advisor

Re: How to compare files/folders on two different servers?

On Redhat Linux, there is a good command called "rsync", which exactly fits my requirement.
I can use "rsync -n" for just comparison ( dry run option ), and sync without "-n".

Is there a similar one for HP-UX?
Thanks!
Rodney Hills
Honored Contributor

Re: How to compare files/folders on two different servers?

Can you set up a NFS share between the 2 servers? Then you could use the diff command.

For synchronizing between them look at the rsync command which can be found on the software porting and archive center.

http://hpux.cs.utah.edu/hppd/hpux/Networking/Admin/rsync-2.6.4/

HTH

-- Rod Hills
There be dragons...
A. Clay Stephenson
Acclaimed Contributor

Re: How to compare files/folders on two different servers?


There is already a set of utilities to do just what you want. rdist (which you already have on your system) and rsync.

http://gatekeep.cs.utah.edu/hppd/hpux/Networking/Admin/rsync-2.6.4/

Both of these have options that will simply list the files that it would copy rather than copying them. Rsync is a more efficient in that it can transfer just the portions of files that have changed.

Man rdist for details.
If it ain't broke, I can fix that.
yyghp
Super Advisor

Re: How to compare files/folders on two different servers?

Thanks!
How to use "diff" to compare a folder and all its subtree folders/files ?
OldSchool
Honored Contributor

Re: How to compare files/folders on two different servers?

diff -r folder1 folder2

see "man diff"
yyghp
Super Advisor

Re: How to compare files/folders on two different servers?

Is there a tool to show detail differences between two servers, like size, timestamp, etc..., instead of just showing the different filenames ?
Thanks!
A. Clay Stephenson
Acclaimed Contributor

Re: How to compare files/folders on two different servers?

If your systems are NFS mounted, you can also use the dircmp comand. Man dircmp for details.
If it ain't broke, I can fix that.
Geoff Wild
Honored Contributor

Re: How to compare files/folders on two different servers?

You can also get a tool from HP called CCMON - mainly designed for clusters - but can be used to compare any servers...

http://h71028.www7.hp.com/enterprise/downloads/ccmon-service-brief.pdf

Or, take a look at Tripwire.

Talk to your HP Account Rep for CCMON - cost is usually 1 technical services day.

Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.