I can run multiple Python scripts simultaneously from a bash script like this;
#!/bin/bash
python pr1.py &
python pr2.py &
python aop.py &
python loader.py &
But what if I want a batch to fire simultaneously and after they've run, start some more sequentially. Will this work?:
#!/bin/bash
python pr1.py &
python pr2.py &
python ap.py &
python loader.py
python cain.py
python able.py
Once you put & at the end, it runs as a background process. Hence all the scripts ending with & run in parallel.
To run the other 3 scripts in sequential order you can try both:
&&
runs the next script only if the preceding script has run successfully
python loader.py && python cain.py && python able.py
||
runs scripts sequentially irrespective of the result of preceding script
python loader.py || python cain.py || python able.py
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With