-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexecute-ia.sh
executable file
·43 lines (34 loc) · 1.41 KB
/
execute-ia.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/bash
TERMFS=10
SPORT=$(( ( RANDOM % 1000 ) + 2000 ))
PPORT1=$(( ( RANDOM % 1000 ) + 3000 ))
PPORT2=$(( ( RANDOM % 1000 ) + 4000 ))
OPORT1=$(( ( RANDOM % 1000 ) + 5000 ))
OPORT2=$(( ( RANDOM % 1000 ) + 6000 ))
IA1=$1
IA2=$2
if test x$IA1 = x -o x$IA2 = x; then
echo "usage: $0 <ia1> <ia2>"
exit 1
fi
source ./execute-lib.sh ; cd ..
make_empire
# Demarrage des programmes.
launch_xterm "./empire-server/Main.native -sport ${SPORT} 2>&1 | tee out_S" SPID 0 0
launch_xterm "./empire-tee/tee.py localhost ${SPORT} ${PPORT1} ${OPORT1}" TPID1 0 370
#launch_xterm "./empire-tee/tee.py localhost ${SPORT} ${PPORT1} ${OPORT1} 2>&1 | tee out_T1" TPID1
launch_xterm "./empire-client/Main.native -obs -sport ${OPORT1}" OPID1 485 0
launch_xterm "./empire-captain/ai${IA1}.py localhost ${PPORT1} 2>&1 | tee out_P1" PPID1 970 0
launch_xterm "./empire-tee/tee.py localhost ${SPORT} ${PPORT2} ${OPORT2}" TPID2 0 370
#launch_xterm "./empire-tee/tee.py localhost ${SPORT} ${PPORT2} ${OPORT2} 2>&1 | tee out_T2" TPID2
launch_xterm "./empire-client/Main.native -obs -sport ${OPORT2}" OPID2 485 370
launch_xterm "./empire-captain/ai${IA2}.py localhost ${PPORT2} 2>&1 | tee out_P2" PPID2 970 370
PIDS="${SPID} ${TPID1} ${OPID1} ${PPID1} ${TPID2} ${OPID2} ${PPID2}"
# Regarde si un des programmes est stoppe.
STOPPED=0
while test $STOPPED -eq 0; do
sleep 2
check_processes STOPPED ${PIDS}
done
# Arret de tous les programmes.
stop_processes ${PIDS}