Skip to content

Commit

Permalink
Update run.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
xiangmy21 authored May 11, 2024
1 parent 2f7d73b commit b1a4d17
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions dependency/shell/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ read_array() {

function retry_command {
local command="$1"
local max_attempts=10
local max_attempts=5
local attempt_num=1
local sleep_seconds=5
local sleep_seconds=10

while [ $attempt_num -le $max_attempts ]; do
echo "Attempt $attempt_num / $max_attempts to run command: $command"
Expand Down Expand Up @@ -174,7 +174,7 @@ elif [ "$TERMINAL" = "CLIENT" ]; then
cp -r $python_main_dir $python_main_dir$i
cp -f ./$code_name.py $python_main_dir$i/PyAPI/AI.py

command="nice -0 python3 $python_main_dir$i/PyAPI/main.py -I $CONNECT_IP -P $PORT -p $j > $playback_dir/team$k-player$j.log 2>&1"
command="nice -0 python3 $python_main_dir$i/PyAPI/main.py -I $CONNECT_IP -P $PORT -p $j > $playback_dir/team$k-player$j.log 2>&1 &"

retry_command "$command" &

Expand All @@ -183,7 +183,7 @@ elif [ "$TERMINAL" = "CLIENT" ]; then
elif [ -f "./$code_name" ]; then
echo "find ./$code_name"

command="nice -0 ./$code_name -I $CONNECT_IP -P $PORT -p $j > $playback_dir/team$k-player$j.log 2>&1"
command="nice -0 ./$code_name -I $CONNECT_IP -P $PORT -p $j > $playback_dir/team$k-player$j.log 2>&1 &"
retry_command "$command" &

ps -aux |grep $code_name
Expand All @@ -201,15 +201,15 @@ elif [ "$TERMINAL" = "CLIENT" ]; then
cp -r $python_main_dir $python_main_dir$i
cp -f ./$code_name.py $python_main_dir$i/PyAPI/AI.py

command="nice -0 python3 $python_main_dir$i/PyAPI/main.py -I $CONNECT_IP -P $PORT -p $j > $playback_dir/team$k-player$j.log 2>&1"
command="nice -0 python3 $python_main_dir$i/PyAPI/main.py -I $CONNECT_IP -P $PORT -p $j > $playback_dir/team$k-player$j.log 2>&1 &"

retry_command "$command" &

ps -aux |grep main.py
elif [ -f "./$code_name" ]; then
echo "find ./$code_name"

command="nice -0 ./$code_name -I $CONNECT_IP -P $PORT -p $j > $playback_dir/team$k-player$j.log 2>&1"
command="nice -0 ./$code_name -I $CONNECT_IP -P $PORT -p $j > $playback_dir/team$k-player$j.log 2>&1 &"

retry_command "$command" &

Expand Down

0 comments on commit b1a4d17

Please sign in to comment.