Right. Unfortunately, httpd not only gets a ppid of 1, but it starts a new process group itself (which makes sense for its needs). If only a process could be a member of multiple hierarchical process groups :), but as I understand it, it only gets one.
On Tue, 25 Aug 2009 09:56 +0100, "Mark Morgan" <makk...@gmail.com> wrote: > On Mon, Aug 24, 2009 at 6:37 PM, Jonathan Swartz<swa...@pobox.com> wrote: > > Yes, getting the pid from each process launch is not the problem - it's > > more of a wish that I could do this automagically somehow, instead of > > having to collect all the pids somewhere. But it seems as if I'll have > > to do that. > > Is it feasible for what your doing to fork off, and do a setsid call > to create a new process group? If so, at the end of the testing, you > can just send a signal to your process group, to kill off the > forked-off processes. Saves having to keep track of all forked off > processes... > > sample script (without error checking) > > === > #!/usr/bin/perl > > use strict; > use warnings; > > use POSIX qw( setsid ); > > if ( fork ) { > exit; # parent just exits > } > > my $sid = setsid; > > # do work here > > kill -2, $sid; # negative signal to send to process group > === > > Mark.