[Zope] Killing children process

Alan alanwilter at gmail.com
Thu Sep 7 12:04:20 EDT 2006


Hi List!

Maybe it is more a question about python, but here it goes...

I have an application in Zope which spawns a process (1) in
background, a python program by the way. I monitor the process (1) via
the PID returned.

Embedded in (1), it uses os.system to run an application (2) which
does the real job. (2) is a bash script with several embedded
programs.

However, sometimes I need to kill (1) (os.kill), and I hopped when
killing (1), (2) and any of its children should be killed as well. But
it does not happen; system (PID 1) inherit (2).

I know if I were able to keep a list of any children and grandchildren
process I could kill all of them smoothly, however for such a list I
have no idea of doing it but:
a)- doing a program to track them via unix command 'ps' output (maybe
not reliable);
b)- changing the code of the 3rd party programs (not really a good idea at all).

All interaction are done via portal made in Zope.

So, if someone could give any idea of how tackle with this problem,
mainly avoiding a) and b), I would appreciate a lot.

To simplify, I would like to know if python is able to kill a process
and its 'family' without much hassle, and if so, how?

Many thanks in advance.

Cheers,
Alan

-- 
Alan Wilter S. da Silva, D.Sc. - Research Associate
Department of Biochemistry, University of Cambridge.
80 Tennis Court Road, Cambridge CB2 1GA, UK.
>>http://www.bio.cam.ac.uk/~awd28<<


More information about the Zope mailing list