in reply to Test for daemon
The nice, clean way is to use Proc::ProcessTable, as in:use strict; my $rc=system("ps -ef | grep [i]netd"); if ($rc) {print "inetd seems to have gone the way of the dodo.\n"};
Warning: the above code is untested. It could work, but it also could wipe your hard drive, send mail professing your never ending devotion to everyone you have ever mailed to, paint your cats green and your house orange and make a camel crawl through the eye of a needle. You have been warned.use strict; use Proc::ProcessTable; my $proctable=Proc::ProcessTable->new; my $proclist= $proctable->table; my @result=map {/(inetd)/} @$proclist; unless (scalar(@result)) {print "inetd->walk({direction=>dodo})\n"};
CU
Robartes-
Update:Got rid of the grep -v grep I mindlessly copy/pasted into the code. Thanks to merlyn for pointing out this important issue.
| Replies are listed 'Best First'. | |
|---|---|
|
Say "no" to "grep -v grep"
by merlyn (Sage) on Oct 08, 2002 at 21:25 UTC | |
|
Re: Re: Test for daemon
by l2kashe (Deacon) on Oct 08, 2002 at 23:11 UTC | |
|
Re: Re: Test for daemon
by VSarkiss (Monsignor) on Oct 08, 2002 at 21:22 UTC |