#! /usr/bin/sh
#
#ident	"@(#)rcptree.sh	1.5	04/12/08 SMI"
#
# Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
# Use is subject to license terms.
#
# by Mark F. Logan

if [ $# -ne 1 ]
then
	echo usage: $0 remote-machine
	exit 1
fi

echo You must set up .rhosts on $1 to allow rcp

local=`hostname`

while :
do
	date
	rcp -rp /kernel $1:/export/home/tmp/kernel.$local.$$
	rcp -rp $1:/export/home/tmp/kernel.$local.$$ kernel.$$
	if diff -r kernel.$$ /kernel
	then
		rm -rf kernel.$$ &
		rsh $1 rm -rf /export/home/tmp/kernel.$local.$$ < /dev/null
		wait
	else
		exit $?
	fi
done
