Re: OT: perl/processes
On Thu, Apr 13, 2000 at 10:45:35AM -0400, Brian Clark wrote:
> Would any of the perl users in this group know an easy way, with perl, to
> check to see if a certain process is present? Say, httpd?
>
> I was going to parse the output of ps but that just seems stupid..
---end quoted text---
It's One Way to do it.
A couple of others are:
1) If you know there should be a lockfile for that process while
it is running, look for it. Or a pid file (a file in a known
location with a known name to which the pid is written, which
exists so that some other process can kill the daemon later).
2) Try to connect to the appropriate socket for a daemon that
listens on a socket.
Any others?
Don't forget: TMTOWDI[*] and as long as they all produce correct
results, then they're all equally valid.
--
bjb@achilles.net
[*] There's More Than One Way to Do It, the official mantra
of perl programmers.
Reply to: