Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Finding an active process

Status
Not open for further replies.

gem65

Programmer
Aug 27, 2002
3
US
I am trying to find out if a process is active wanting to return a value 1 or 0 ( true or false).

(like ps -ef|grep command)
 
something like this might help

sub process_is_active($){
my $process_name = shift;
open(PS,'ps -ef|';
while(<PS>){
next unless /$process_name/o;
return 1;
}
return 0;
} Mike

&quot;Experience is the comb that Nature gives us, after we are bald.&quot;

Is that a haiku?
I never could get the hang
of writing those things.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top