0) return 1; return 0; } */ function is_process_running($process) { $status = `/bin/ps ax | /usr/bin/grep {$process} | wc -l`; if($status > 2) return 1; return 0; } 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(strtolower($service) == strtolower($aservice['name'])) { if(!$aservice['executable']) return false; if(in_array($aservice['executable'], $ps)) { return true; } else { return false; } break; } } } return false; }