I'm making a python script (start.py) to run multiple (4) python scripts. My code:
import subprocess
from time import sleep
y=(0.2)
sleep (y)
subprocess.Popen(["python", 'a1.py'])
sleep (y)
subprocess.Popen(["python", 'a2.py'])
sleep (y)
subprocess.Popen(["python", 'a3.py'])
sleep (y)
subprocess.Popen(["python", 'a4.py'])
When I run start.py the four scripts run in background as I expected, but each one with a process ID. Is it possible to have one PID for all?
And how can I make the start.py run at startup as a service? (i'm using raspberry pi).
execve()s the next, and in your main script begin withexecve()ing the first ;) This way you simply replace processes so it's the same PID all over.import a1, a2, a3, a4; a1.a1(), a2.a2(), ...(actual names should reflect what modules/functions do)os.execve()in each script, so the process gets replaced recursively. I tried to pre-empt that ;) Sorry for lowering the already low signal-to-noise ratio.