I want to execute 4 different files in the background with python, but not simultaneous. There should be ~5 seconds between each evaluation, but I can't get it to work. I tried:
python cmd1 &; sleep 5; python cmd2 &; sleep 5; python cmd3 &; sleep 5; python cmd4 &
But only the first file is executed before the rest. The other three are evaluated at the same time. Then I tried with a double ampersand after each sleep
:
python cmd1 &; sleep 5 && python cmd2 &; sleep 5 && python cmd3 &; sleep 5 && python cmd4 &
So that each python command would wait until the sleep
is done, but that didn't work either. How can I get this to work?
Use parentheses: (sleep 5; python cmd1 &); (sleep 10; python cmd2 &)
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments