#!/bin/sh

# $Id$

OS=`../scripts/os`
CONFIG=`../scripts/config`
RESULTS=results/$OS
BASE=../$RESULTS/`uname -n`
EXT=0

if [ ! -f "$CONFIG" ]
then	echo "No config file?"
	exit 1
fi
. $CONFIG

if [ ! -d ../$RESULTS ]
then	mkdir -p ../$RESULTS
fi
RESULTS=$BASE.$EXT
while [ -f $RESULTS ]
do      EXT=`expr $EXT + 1`
	RESULTS=$BASE.$EXT
done

export SYNC_MAX
export OUTPUT
lmbench $CONFIG 2>${RESULTS}

if [ X$MAIL = Xyes ]
then	echo Mailing results
	(echo ---- $INFO ---
	cat $INFO 
	echo ---- $RESULTS ---
	cat ../$RESULTS) | mail lmbench3@bitmover.com 
fi
exit 0
