From davidw Wed Nov 28 16:29:20 2001 From: David Wood To: mww@caldera.com Subject: dool X-Mailer: ScoMail 3.0.Ca MIME-Version: 1.0 Date: Wed, 28 Nov 2001 16:20:36 -0800 (PST) Content-Type: text/plain; charset=iso-8859-1 Message-ID: <200111281620.aa19413@tahoe.ca.caldera.com> Matt - See my email about driverreq.html. Dave : # # @(#) dool 81.1 99/08/23 # # Copyright (C) 1997-1999 The Santa Cruz Operation, Inc. # # The information in this file is provided for the exclusive use of the # licensees of The Santa Cruz Operation, Inc. Such users have the right # to use, modify, and incorporate this code into other products for purposes # authorized by the license agreement provided they include this notice # and the associated copyright notice with any such product. The # information in this file is provided "AS IS" without warranty. # # dool # create a file of a given size, and push it to a given remote # site, then get it back # # (in case you were wondering, the name of this command is an oblique # reference to Dr. Doolittle, and his Pushme-Pullyou.) # # See the usage below or type 'dool' to see the usage. # Make sure you edit the PASSWD variable in this script on each machine. # # Typical Testing scenario: # Run 4 instances of dool, one per console screen going from machine A # to machine B and 4 more from machine B to machine A. Invoke with a few # 1m transfers and some larger transfers like 5m or 10m. # # Note: # IF=/dev/zero gives a continuous stream of zeros for our test data file. # The data file we are transfering is all zeros. # Changing IF=/dev/hd00 gives a somewhat varied data file but requires # root login to access /dev/hd00. PASSWD="" host=$1 size=$2 CNT=0 TMPDOOL=/tmp # On UW7, /tmp is a ramdisk which fills quickly, make a directory to save files FILE=/etc/vfstab STRING="^/tmp" if [ -f $FILE ]; then grep $STRING $FILE > /dev/null if [ $? = 0 ]; then TMPDOOL=$HOME/tmpdool if [ ! -d $TMPDOOL ]; then mkdir $TMPDOOL fi fi fi tfile=$TMPDOOL/dool$$ IF=/dev/zero GET=$TMPDOOL/dool$$.get cleanup () { rm -f $tfile $GET # Don't remove TMPDOOL directory - it kills off other dools #if [ $TMPDOOL != /tmp ]; then #rm -rf $TMPDOOL #fi exit $1 } usage () { echo "Usage: dool host size" echo " 'host' is the remote host name." echo " 'size' is in bB, kK, mM - usually 1m (1Mb) or 10m (10Mb)." } if [ $# -ne 2 ]; then usage exit 1 fi if [ -z "$PASSWD" ]; then echo "Error: You must set the \"PASSWD\" variable in $0." cleanup 3 fi # Make sure LOGNAME not a restricted ftp user (in /etc/ftpusers). FILE=/etc/ftpusers if [ -f $FILE ]; then grep "^$LOGNAME" $FILE > /dev/null if [ $? = 0 ]; then echo "Error: You must remove \"$LOGNAME\" from $FILE on both test systems and then run shutdown on both system for $0 to run." cleanup 3 fi fi # On UW7, must uncomment /sbin/sh in /etc/shells to allow root ftp access. if [ $LOGNAME = "root" ]; then FILE=/etc/shells STRING="#/sbin/sh" if [ -f $FILE ]; then grep $STRING $FILE > /dev/null if [ $? = 0 ]; then echo "Error: You must uncomment \"$STRING\" from $FILE on both test systems and then run shutdown on both systems for $0 to run." cleanup 3 fi fi fi trap "cleanup 0" 1 2 3 15 case $size in *[mM]) size=`expr \`expr "$size" : "\(.*\)[Mm]"\` \* 1048576` echo size is now $size ;; *[bB]|*[kK]) ;; *) esac if dd if=$IF of=$tfile bs=$size count=1 then : else echo $USAGE exit 2 fi # Better make directory on remote system too if [ $TMPDOOL != "/tmp" ]; then ftp -in $host <<-! | grep second user $LOGNAME $PASSWD verbose mkdir $TMPDOOL quit ! fi while : do CNT=`expr $CNT + 1` echo $host: \\c ftp -in $host <<-! | grep second user $LOGNAME $PASSWD verbose put $tfile $tfile quit ! echo $host: \\c ftp -in $host <<-! | grep second user $LOGNAME $PASSWD verbose get $tfile $GET quit ! diff $tfile $GET if [ $? != 0 ]; then echo " [$CNT] Data integrity failure!" # don't clean up so we can peruse the diff files. exit 2 #else #echo " [$CNT] Data has integrity." fi rm -f $GET done