I’m trying to use python to launch a command in multiple seperate instances of terminal simultaneously. What is the best way to do this? Right now I am trying to use the subprocess module with popen which works for one command but not multiple.
Thanks in advance.
Edit:
Here is what I am doing:
from subprocess import*
Popen('ant -Dport='+str(5555)+ ' -Dhost='+GetIP()+ ' -DhubURL=http://192.168.1.113:4444 -Denvironment=*firefox launch-remote-control $HOME/selenium-grid-1.0.8', shell=True)
The problem for me is this launches a java process in the terminal which I want to have keep running indefinatley. Secondly, I want to run a similar command multiple times in multiple different processes.
This should stay open as long as the process is running. If you want to launch multiple simultanously, just wrap it in a thread
untested code, but you should get the general idea:
EDIT: The double-fork method described down here: https://stackoverflow.com/a/3765162/450517 by Mike would be the proper way to launch a daemon, i.e. a long-running process which won’t communicate per stdio.