wube has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks. How does one test whether a daemon is up and running ?? My code follows :
my $rc_testd = grep /testd/ , ( `ps -ef` ) ; if ($rc_testd > 0) { print "testd daemon is up and running \n" ; exit 1 ; }
The snippet is in a script called "" . The problem is that this code finds itself running and always exits. What I really want to do is to see if a previous invocation is still active ?? Any advice will me much appreciated. TIA