I have a python routine python.py which basically writes a command string contained in the file Command_text.txt and launches it from terminal, executing:
command = 'bash Command_text.txt'
os.system(command)
Now, the command contained in the Command_text.txt is mpirun which launches a series of parallel python scripts. Now, if i launch the python.py routine from the shell I can simply kill it pressing Ctrl+C. If I use the command nohup python.py & the situation is more complicated as if I ps my processes I need to find and kill the ones with CMD python bash and mpirun to definitely kill all the job (which means all the following parallel python computations), as shown in the image below:
Now my question is: is there a way to kill the python.py original process automatically killing afterwards the relative bash and mpirun ones as when pressing Ctrl+C?
Thanks in advance for the answer!
