mirror of
https://github.com/pfsense/pfsense.git
synced 2025-10-26 11:38:35 +00:00
Move the actual ps component of is_service_running into is_process_running.
This commit is contained in:
parent
0c8de63804
commit
fbeb6d02c0
@ -123,20 +123,29 @@ 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;
|
||||
}
|
||||
|
||||
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(in_array($aservice['executable'], $ps)) {
|
||||
if(is_process_running($aservice['executable'], $ps)) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user