#! /bin/bash
#
# This shell script is a wrapper for running nfsbench repeatedly on
# a number of different server versions. All tests are perfomed via local
# loopback. Results of individual runs are stored in files called
# stats-<version>. After the tests are complete, summaries are produced
# and stored in summary-<version>.
#
# NOTE: This script spawns and kills nfsd's at its whim. After the script
# is complete, you have to restart your normal nfsd.
#
# Copyright (C) 1995 O. Kirch <okir@monad.swb.de>

mountpoint=/mnt/pub
servers="2.0 2.1 2.2a6"
runs=20

running=`ps -a | grep 'rpc.nfsd$'`
if test "$running"; then
	set -- $running
	kill -9 $1
fi

let round=0;
while [ $round -lt $runs ]; do
	for srv in $servers; do
		echo "$round: benchmarking $srv"
		/usr/sbin/rpc.nfsd-$srv
		su okir -c "perl nfsbench.pl $mountpoint" >> stats-$srv
		killall -9 rpc.nfsd-$srv
	done
	let round=$round+1
done

for srv in $servers; do
	perl summary.pl < stats-$srv > summary-$srv
done
