From 1f846058583cc73b6a8241469abab68a3936eedc Mon Sep 17 00:00:00 2001 From: Colin Smith Date: Sun, 26 Jun 2005 03:57:18 +0000 Subject: Revert is_service_running to rev 1.10. --- etc/inc/service-utils.inc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/etc/inc/service-utils.inc b/etc/inc/service-utils.inc index 9f9a487..8845a95 100644 --- a/etc/inc/service-utils.inc +++ b/etc/inc/service-utils.inc @@ -131,11 +131,18 @@ function is_process_running($process) { function is_service_running($service, $ps = "") { global $config; + 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($config['installedpackages']['service']) { foreach($config['installedpackages']['service'] as $aservice) { if($service == $aservice['name']) { if(!$aservice['executable']) return false; - if(is_process_running($aservice['executable'], $ps)) { + if(in_array($aservice['executable'], $ps)) { return true; } else { return false; -- cgit v1.1