#! /bin/sh
# The SPIMS software is covered by a license. The use of the software
# represents acceptance of the terms and conditions in the license.
# ******************************************************************
# Copyright (c) 1989, Swedish Institute of Computer Science
# parameters: [-F <flag>] host names and protocol names
# Add from: udp tcp ftp ftam sunrpc tcprpc isoros null tsap
DEF_PROTOCOLS="udp tcp ftp sunrpc tcprpc null"
DEF_HOSTS=`hostname`
# ALL_HOSTS="< list of host names >"
ALL_HOSTS=""
PROTOCOLS=""
HOSTS=""
FLAG=""
if [ "$1" = "-F" ]; then
	if [ $# = "0" -o $# = "1"  ]; then
		echo "Usage: $0 -F <flag> host_and_protocol_list"
		exit 1
	fi; FLAG=$2; shift; shift
fi
for p in $@; do
	if [ $p = "ALL" ]; then
		HOSTS=$ALL_HOSTS;
	elif [ -d $SPIMSDIR/$p ]; then
		PROTOCOLS="$PROTOCOLS $p"
	else
		HOSTS="$HOSTS $p"
	fi
done
if [ "$HOSTS" = "" ]; then
	HOSTS=$DEF_HOSTS
fi
if [ "$PROTOCOLS" = "" ]; then
	PROTOCOLS=$DEF_PROTOCOLS
fi
echo Starting benchmark demons on $HOSTS for the $PROTOCOLS protocols
for host in $HOSTS; do
	if [ "$FLAG" = "" ]; then
		startdemon $host $PROTOCOLS
	else
		startdemon -F "$FLAG" $host $PROTOCOLS
	fi
done

