[clug] Comparing machines

Michael James clug at james.st
Wed Aug 4 00:58:57 GMT 2004


On Tue, 3 Aug 2004 11:05 pm, Martijn van Oosterhout wrote:

> I have two machines which should be almost but not quite identical.
> What I would like to do is have some kind of diff between the two. I
> can probably use rsync --dry-run to get a list of changed files, but I
> want a diff. I'd rather not use NFS mounts if possible. Any other
> suggestions?

For keeping individual files in sync across machines,
 I find this simple "rdiff" script invaluable.

<file> can be specified with relative or absolute paths.
It assumes the other machine has the file in the same place.
It is a lot more convenient if you have rsh trust or ssh keys.



#!/bin/sh

# Usage:  rdiff  <local-file> <other-host>

pwd=`pwd | sed -e 's/\/$//'`
file=`echo $1 | sed -e "s%^\([^/]\)%$pwd/\1%"`

lochost=`uname -n`
remhost=$2

echo "< $lochost:$file"
echo "> $remhost:$file"
echo

rsh $remhost "/bin/cat $file" | diff $file -



-- 
Michael James                         michael.james at csiro.au
System Administrator                    voice:  02 6246 5040
CSIRO Bioinformatics Facility             fax:  02 6246 5166


More information about the linux mailing list