From 4c943221a4de412c64d7070dc2ac567402923993 Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Sat, 25 Jun 2005 23:06:43 +0000 Subject: Make is_process_running() work as it should for the frickin 5th time. --- etc/inc/service-utils.inc | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/etc/inc/service-utils.inc b/etc/inc/service-utils.inc index 602eee6..d2ab1c8 100644 --- a/etc/inc/service-utils.inc +++ b/etc/inc/service-utils.inc @@ -124,19 +124,9 @@ function restart_service($name) { } function is_process_running($process, $ps = "") { - if(!$ps) { - exec("/bin/ps ax | awk '{ print $5 }'", $psout); - array_shift($psout); - foreach($psout as $line) { - $ps[] = trim(array_pop(explode(' ', array_pop(explode('/', $line))))); - } - } - if(in_array($process, $ps)) { - return true; - } else { - return false; - } - return false; + $status = `/bin/ps ax | /usr/bin/grep {$service_name} | wc -l`; + if($status > 2) return 1; + return 0; } function is_service_running($service, $ps = "") { -- cgit v1.1