develooper Front page | perl.beginners | Postings from April 2002

Re: Process Tree

Thread Previous
From:
drieux
Date:
April 27, 2002 07:34
Subject:
Re: Process Tree
Message ID:
E1CC257A-59EB-11D6-B9F6-0030654D3CAE@wetware.com

On Saturday, April 27, 2002, at 06:08 , sharan wrote:

> Hello,
>
> Is there any generic way to find the list of child ids? (common to windows
> and Linux). Because, i want to kill explicitly all the child procs before
> terminating parent.

generically you want

	man ps

that will help with the link process - the trick of course
is that these fluctuate from *nix platform to platform -

{ can not help you with the 'windows' side - since their
process management schema is not always clear... }

then depending upon whether your OS allows for - and you implemented
things like 'session ID's so that you can track on that with say

	ps --sid $sidVal

you would of course want to start from the outside in...

Or you are off for the day at the races with the canonical parse
down problem of

	given $pid

	find all $cpids such that PPID_of_cpid == $pid

if you are looking to code that.

What I prefer to do in these cases - for production releases,
is mandate that the daemons run as a specially named UID - so
that we can glob all of them with some form of

	ps -u $special_uid

and walk around the results.

ciao
drieux

---


Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About