in reply to How do I examine the status of a process?
In general, you can use "kill" with signal number zero
to check on the existence of a process. See 'man perlipc' for
details. Here's code:
use strict; MAIN: { my $pid = $ARGV[0]; if (kill 0 => $pid) { print STDOUT "Process '$pid' exists\n"; } else { print STDOUT "Process '$pid' does not exist\n"; } }
|
---|
In Section
Seekers of Perl Wisdom