-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathstart.sh
executable file
·54 lines (39 loc) · 908 Bytes
/
start.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
44
45
46
47
48
49
50
51
52
53
54
#!/bin/bash
# export PYTHONPATH="${PYTHONPATH}:`pwd`"
python_env=.venv/bin/activate
source $python_env
# Set the options, all the options are passed as environment variables
log_path="logs/$(date +%Y-%m-%d_%H-%M-%S)"
options="--log-path $log_path"
options="$options $@"
echo "Options: $options"
# Function to handle termination
cleanup() {
echo "Terminating all start_agent.py processes..."
for pid in "${pids[@]}"; do
kill $pid
done
exit 0
}
# Trap SIGTERM and SIGINT signals
trap cleanup SIGTERM SIGINT
run_command="python3 main.py"
# list of pids
pids=()
# Example of running the command and storing the PID
# Run the command
$run_command $options --goalie &
pids+=($!)
sleep 1
i=2
while [ $i -le 11 ] ; do
$run_command $options --player &
pids+=($!)
sleep 0.2
i=`expr $i + 1`
done
sleep 2
$run_command $options --coach &
pids+=($!)
# Wait for all pids
wait "${pids[@]}"