- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Need to compare files in different server
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-24-2009 03:16 AM
11-24-2009 03:16 AM
Need to compare files in different server
I need to compare details like size,file name & permission of files from production with DR.Please suggest me the most easiest methods to compare the files in different server when the file count is huge.
Thanks in advance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-24-2009 03:25 AM
11-24-2009 03:25 AM
Re: Need to compare files in different server
'chksum' will be only one line and easy to read, if you get the same equal result on both files then the files are exact. 'diff' will be a huge report but you can pipe the stderr to null and just test the "$?" for > zero. And you'll probably want remsh or ssh -l configured for remote login and remote command execution. This is probably already set up.
Put them all in a script after configuring the remote execution using a input file read by both.
cat input_file | while read a
do
remsh cksum $a
done > output_file
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-24-2009 03:34 AM
11-24-2009 03:34 AM
Re: Need to compare files in different server
you can also use wc that shows also total like these :
# wc tmp1 tmp1
89 89 5251 tmp1
89 89 5251 tmp1
178 178 10502 total
# remsh host1 "wc /path_to_file1/tmp1 /path_to_compare/tmp2"
89 89 5251 /path_to_file1/tmp1
239 239 14101 /path_to_file1/tmp2
328 328 19352 total
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-24-2009 03:54 AM
11-24-2009 03:54 AM
Re: Need to compare files in different server
another concept is to use ll OR ls -l UX command ;
# remsh host1 "ll /path/tmp1 /path/tmp2 > /tmp/oku"
# cat /tmp/oku |awk {'print $5,$6,$7,$8,$9'}
5251 Mar 18 2008 /path/tmp1
14101 Mar 18 2008 /path/tmp2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-24-2009 05:34 AM
11-24-2009 05:34 AM
Re: Need to compare files in different server
> name & permission [...]
What about the contents of the files?
"ls -lR" would show those meta-data, but not
the file contents.
> 'chksum' will be only one line [...]
"cksum" of _what_ "will be only one line"?
> [...] remsh or ssh [...]
NFS might be simpler.
The value of different comparison methods
tends to depend on factors which are still
unknown, like how good the network connection
is between these systems, and exactly what
you wish to compare.
> [...] the file count is huge.
> remsh cksum $a
One "remsh" per file probably wouldn't be my
first choice of methods.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-24-2009 05:44 AM
11-24-2009 05:44 AM
Re: Need to compare files in different server
so I know nothing, but the "-n" option:
-n, --dry-run perform a trial run with no changes made
might be useful for comparisons.
How are you getting these data to the DR
system in the first place? "rsync" could be
useful for more than just comparisons.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-24-2009 06:29 AM
11-24-2009 06:29 AM
Re: Need to compare files in different server
Thanks for your valuable suggestions
Hi Steven,
I need to identify differences between 2 directory which are in different server(prod & DR).
what all things to be compared?
1.Ownership(user and group)
2.Permission
3.File name,content & size
and have to list missing files which are in prod and not in DR.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-24-2009 07:47 AM
11-24-2009 07:47 AM
Re: Need to compare files in different server
cd DIRNAME
find . -exec ls -1 {} \; | while read F; do
echo "$F $(/bin/ls -l $F | awk '{print $1,$3,$4}') $(sum $F)"
done| sort > $DIRNAME.out
The .out files contain all or almost all requested parameters. Diff the files from both computers.
Additional question: Why do you need this ? If you need to synchronize two machins, rsync is the best solution, as it was mentioned earlier.
HTH
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-24-2009 08:54 AM
11-24-2009 08:54 AM
Re: Need to compare files in different server
available, then a plain "diff -R" would tell
you about the file contents, and a "diff"
between "ls -lR" reports would tell you the
rest. It would make some sense not to worry
about the date-time values on directories, so
a little more work to eliminate those would
be useful.
If the network is slow, or if NFS is not
available, then you should be able to use
"find" and "chksum" (and "diff") to test for
mismatched file contents without copying
everything across the network.
Are you looking for ideas, or were you
waiting for someone to write a script for
you?
> [...] rsync is the best solution [...]
Nah, that was a five-point answer.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-24-2009 09:01 AM
11-24-2009 09:01 AM