0

I have recently been developing a bash script to automatically run another python script I developed with selenium 10 times concurrently. I would usually use multiprocess inside of python but selenium has caused me some pain in concurrently running browsers.

In my bash script I have written a simple loop like below:

rangeEnd=$((10000/1000))
for num in $(seq 1 $rangeEnd)
do
  python3 myscript.py $num & disown;
wait
done
python3 nextscript.py
echo All done

What has perplexed me is that instead of running myscript.py 10 times and then after those scripts complete having nextscript.py execute, it seems to just execute the command myscript.py 10 times then immediately exit the loop and run the last script nextscript.py.

What I am hoping to figure out is, how I would make sure the bash script does not execute the final nextscript.py until all ten instances of myscript.py are complete.

For what it is worth, myscript.py should take somewhere in the order of 10 hours to complete running.

Sorry if this has been answered before, I am new to bash scripting and had some difficulty finding answers.

Sean_Boothby
  • 147
  • 1
  • 2
  • 13

0 Answers0