Sample Start Scripts

Sample start scripts

You need 7 files (start, start1, start2, start3, kill1, kill2, and kill3)

The scripts can be downloaded for

start Explanation
#! /bin/bash

trap kill_team INT

kill_team()
{
    echo "Killing Team"
    ssh -l [LOGNAME] $2 -f $1/kill1 
    ssh -l [LOGNAME] $3 -f $1/kill2
    ssh -l [LOGNAME] $4 -f $1/kill3
    exit 0
}

ssh -l [LOGNAME] $2 -f $1/start1 $5
sleep 3
ssh -l [LOGNAME] $3 -f $1/start2 $5
sleep 3
ssh -l [LOGNAME] $4 -f $1/start3 $5

wait
	    
This is your top level start script. Usually, there should be no need to change it at all for your team. It will be called by the Soccer Server with five command line parameters:

start <YOUR HOME DIR> <MACHINE1> <MACHINE2> <MACHINE3> <SERVER MACHINE>

After the match, the script will receive a signal from the Soccer Server and run the kill scripts. If you do not understand what happens here, just copy the script to your home directory and replace [LOGNAME] by your login name.

Below are sample scripts starting a team on 3 machines. Please use absolute file names and make them group executable.
Please also remember that your team is started by a different user, so don't use variables like $HOME, or ~/ in your paths.

start1 start2 start3
#! /bin/sh

host=$1

goalie=/home/robolog/bin/oli
player=/home/robolog/bin/player

${goalie} --host ${host} --goalie &

sleep 2

${player} --host ${host} &
${player} --host ${host} &
${player} --host ${host} &	    
	  
#! /bin/sh

host=$1

player=/home/robolog/bin/player

${player} --host ${host} &
${player} --host ${host} &
${player} --host ${host} &
${player} --host ${host} &
	    
#! /bin/sh

host=$1

player=/home/robolog/bin/player
coach=/home/robolog/bin/giovanni

${player} --host ${host} &
${player} --host ${host} &
${player} --host ${host} &
${coach} --host ${host} &
	    

Sample kill scripts (don't use path names here). Please make them group executable and double check that they kill all of your programs

kill1 kill2 kill3
#! /bin/sh

goalie=oli
player=player

killall -KILL ${goalie}
killall -KILL ${player}
	    
#! /bin/sh

player=player

killall -KILL ${player}
	    
#! /bin/sh

player=player
coach=giovanni

killall -KILL ${player}
killall -KILL ${coach}