Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
My question is this...my $t = new Proc::ProcessTable; foreach my $p ( @{$t->table} ){ if($p->cmndline =~ / member.cgi/) { my $_sec = time() - $p->start; my $_pid = $p->pid; if($_sec > 3 && $pid->is_pid_running($_pid)) { $pid->kill( $_pid ); print qq~$_pid was running for $_sec seconds...\n~; } } }
Is there a way to get the table to only give me the pids running with member.cgi contained in the cmndline field? That way it does not have to go through the 200+/- other processes to find those ones?foreach my $p ( @{$t->table} ){ if($p->cmndline =~ / member.cgi/) {
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: using Proc::ProcessTable
by Anonyrnous Monk (Hermit) on Feb 13, 2011 at 11:25 UTC | |
by Anonymous Monk on Feb 13, 2011 at 12:01 UTC |