subprocess - Running shell scripts under one process in Python -


this question has answer here:

i'm quite new shell scripting. have execute shell scripts using python. order of shell scripts important. here example python code

import subprocess import os  script1=  "scripts/script1.sh" script2 = "scripts/script2.sh" script3 = "scripts/script3.sh"  subprocess.call([script1]) subprocess.call([script2]) subprocess.call([script3]) 

the problem above code scripts executed separately 1 after other want run under 1 process.

for example, script2 , script3 should executed while script 1 running.

while op apparently refuses clarify question, left comment indicating looking subprocess.popen().

procs = [] cmd in ['scripts/script1.sh', 'scripts/script2.sh', 'scripts/script3.sh']:     procs.append(subprocess.popen([cmd])) 

you should wait processes have started.


Comments

Popular posts from this blog

java - Suppress Jboss version details from HTTP error response -

gridview - Yii2 DataPorivider $totalSum for a column -

Sass watch command compiles .scss files before full sftp upload -