http://www.perlmonks.org?node_id=240389

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