For running automatic matches, you need to provide two start and two kill scripts. During a match, each team gets two machines. The start scripts have to take the name of the server machine as argument and have to be called "start1" and "start2". The kill scripts have to shutdown your clients. You have to provide kill scripts even if your clients terminate automatically after each match.
Sample start scripts:
| start1 | start2 |
#! /bin/sh
host=$1
goalie=oli
player=player
${goalie} --host ${host} --goalie &
sleep 2
${player} --host ${host} &
${player} --host ${host} &
${player} --host ${host} &
${player} --host ${host} &
${player} --host ${host} &
|
#! /bin/sh
host=$1
player=player
coach=giovanni
${player} --host ${host} &
${player} --host ${host} &
${player} --host ${host} &
${player} --host ${host} &
${player} --host ${host} &
${coach} --host ${host} &
|
Sample kill scripts:
| kill1 | kill2 |
#! /bin/sh
goalie=oli
player=player
killall -KILL ${goalie}
killall -KILL ${player}
|
#! /bin/sh
player=player
coach=giovanni
killall -KILL ${player}
killall -KILL ${coach}
|
| Staring your team | Explanation |
#! /bin/bash
trap kill_team INT
kill_team()
{
echo "Killing Team"
ssh $2 -f $1/kill1
ssh $3 -f $1/kill2
exit 0
}
ssh $2 -f $1/start1 `hostname`
sleep 3
ssh $3 -f $1/start2 `hostname`
wait
|
This is the script we will use to startup all the teams. The script will be executed on the server machine. It takes 4 parameters: $1 is the name of your home directory (where your scripts are located), and parameters $2 -- $4 are the names of the client machines. When the match is over, the kill scripts will be executed on the client machines. You can also download the complete match system we will be using. The scripts are derived from those written by Tom Howard for Simulated Soccer Internet League. Additionally, you need the "cointoss" program available in the Soccer Server CVS on SourceForge (package rcsoccersim). |