#!/bin/sh
# Shell script that spawns a number of DistributedServerRMIGeneric depending
# on the number received in the first parameter.
#  
# Author: Daniel Lazaro Cuadrado (kapokasa@kom.aau.dk)
# Version: 
# 
# @Copyright (c) 2005-2006 The Regents of Aalborg University.
# All rights reserved.
#
# Permission is hereby granted, without written agreement and without
# license or royalty fees, to use, copy, modify, and distribute this
# software and its documentation for any purpose, provided that the
# above copyright notice and the following two paragraphs appear in all
# copies of this software.
#
# IN NO EVENT SHALL AALBORG UNIVERSITY BE LIABLE TO ANY PARTY
# FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
# ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
# AALBORG UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# AALBORG UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES,
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
# PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND AALBORG UNIVERSITY
# HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,
# ENHANCEMENTS, OR MODIFICATIONS.


if test $# -eq 0
then 
	limit=5
	echo "No number of servers provided, using default... (5)"
	echo $limit
else
	limit=$1
fi

echo "starting: $limit servers..."
count=1

while [ ${count} -le ${limit} ]
do
	echo "count: $count"
	count=`expr ${count} + 1` 
	./startserver &
done