Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Hi,
Can anyone tell me how I can capture system output when using the system() command?
I.e. I want to check if a process is running and do something if it isn't
This doesn't work because $runcheck just equals 0
sub checkRunning {
my $runcheck = system("ps -deaf | grep httpd | grep -v grep | wc -l");
if ($runcheck > 0) {
&writeLog('rsync process already running');
return '';
} else {
return 'Not Running';
}
}
I'd be happy to hear any ideas about this thanks!
Tom
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Capturing System Output
by BazB (Priest) on Mar 04, 2003 at 16:11 UTC | |
|
Re: Capturing System Output
by hardburn (Abbot) on Mar 04, 2003 at 16:17 UTC | |
|
Re: Capturing System Output
by ignatz (Vicar) on Mar 04, 2003 at 16:17 UTC | |
by Anonymous Monk on Mar 04, 2003 at 16:19 UTC |