GoingMyWay
GoingMyWay

Reputation: 17468

Run a shell script with setsid in it error

I made shell script to run my task with many seeds. Here is my shell script

task.sh

for i in 1 2 3 4 5
do
    setsid python main.py --random-seed 24 1>data/${i}_24.log 2>&1
    sleep 3
done
echo "OK 1"


for i in 1 2 3 4 5
do
    setsid python main.py --random-seed 48 1>data/${i}_48.log 2>&1
    sleep 3
done

echo "OK 2"

for i in 1 2 3 4 5
do
    setsid python main.py --random-seed 60 1>data/${i}_60.log 2>&1
    sleep 3
done

echo "OK 3"

However, the first process with seed 24 with i=1 has been launched and the following process had not been launched. I think the reason may be in shell script it only supports running process one by one. How can I fix it to run all the process in background?

Upvotes: 0

Views: 582

Answers (0)

Related Questions