in reply to Logging out
Update
Well, the following snippet of code is pretty ugly, but it seems to work. It is executed by the server program in response to a command from the client via SOAP.
What this does is get a list of all running processes, finds one named "login -- mrc", then goes through the list looking for all its children, children's children, etc. Once it's done this, it kills them all. Ugh.my @ps = `ps -ef`; my @pid = (split(/ +/, (grep(/login -- mrc/, @ps))[0]))[1]; my @kill; while (1) { last unless @pid = grep {$_ > 1} @pid; push @kill, @pid; my $pidlist = join('|', @pid); last unless @pid = grep(/\s+[\d]+\s+($pidlist) /, @ps); @pid = map {(split(/\s+/, $_))[1]} @pid; } kill 'TERM', @kill
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: Logging out
by rob_au (Abbot) on Oct 28, 2001 at 10:09 UTC | |
by Dr. Mu (Hermit) on Oct 30, 2001 at 08:36 UTC |
In Section
Seekers of Perl Wisdom