Added scripts to repo. And some changes to report.
[packetlaptime.git] / generate-test-script.sh
blob8f4cc8e427a4e521acd8455e68dacd0d52e6b995
1 #! /bin/bash
2 javacflags="-classpath ~/edu/doi/lab2"
3 numberofnodes=
4 nodtyp=
5 firsthost=
6 secondhost=
8 function usage {
9 echo "Usage: $0 <number of nodes> <node type> <first host> <second host>"
12 if [ "$1" = "" ]
13 then
14 echo No parameters given.
15 usage
16 exit
17 elif [ "$2" = "" ]
18 then
19 echo No node type given.
20 usage
21 exit
22 elif [ "$3" = "" ]
23 then
24 echo No first host name given.
25 usage
26 exit
27 elif [ "$4" = "" ]
28 then
29 echo No second host name given.
30 usage
31 exit
32 else
33 numberofnodes=$1
34 nodtyp=$2
35 nodtypupcase=`echo $2 | tr [:lower:] [:upper:]`
36 firsthost="$3"
37 secondhost="$4"
40 for ((i=0;i<$numberofnodes-2;i+=2))
42 echo "java $javacflags "$nodtypupcase"Node `expr 9800 + $i` $secondhost `expr 9800 + $i + 1` &" >> $nodtyp.$numberofnodes.$firsthost.sh
43 echo "java $javacflags "$nodtypupcase"Node `expr 9800 + $i + 1` $firsthost `expr 9800 + $i + 2` &" >> $nodtyp.$numberofnodes.$secondhost.sh
44 done
46 echo "java $javacflags "$nodtypupcase"Node `expr 9800 + $i` $secondhost `expr 9800 + $i + 1` &" >> $nodtyp.$numberofnodes.$firsthost.sh
47 echo "java $javacflags "$nodtypupcase"Node `expr 9800 + $i + 1` $firsthost `expr 9800` L &" >> $nodtyp.$numberofnodes.$secondhost.sh