summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--etc/inc/service-utils.inc9
1 files changed, 8 insertions, 1 deletions
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;
OpenPOWER on IntegriCloud