D
dfaber
Aloha!
I want to terminate a process/program from within a python script.
For example,
if I have a program say foo.sh that starts running, then I can run it
from within a python script using
os.popen('foo.sh') which starts a program/process say 'bar'
At some point later, I want to kill 'bar'. Currently, I start off the
process and then when the python script exits, the process 'bar' is
still running and I have to issue ps -ef | grep 'bar' and then kill
it.
Is there any better way of doing this?
I want to terminate a process/program from within a python script.
For example,
if I have a program say foo.sh that starts running, then I can run it
from within a python script using
os.popen('foo.sh') which starts a program/process say 'bar'
At some point later, I want to kill 'bar'. Currently, I start off the
process and then when the python script exits, the process 'bar' is
still running and I have to issue ps -ef | grep 'bar' and then kill
it.
Is there any better way of doing this?