Added custom_php_service_status_command support for packages.

Package authors can define a
custom_php_service_status_command
block in their package XML. Such block should only contain function
calls, and the first should be one to include their function library
file if necessary, as this is not done by service-utils.inc.

The return code of the last function call will be returned to the service
check.
This commit is contained in:
Scott Ullrich 2009-03-12 16:00:02 -04:00
parent fb5ba3b3c3
commit 082be6a9f5

View File

@ -167,14 +167,15 @@ function is_service_running($service, $ps = "") {
if(is_array($config['installedpackages']['service'])) {
foreach($config['installedpackages']['service'] as $aservice) {
if(strtolower($service) == strtolower($aservice['name'])) {
if(!$aservice['executable']) return false;
/*
if(count(preg_grep("/{$aservice['executable']}/i", $ps))) {
return true;
} else {
if(!$aservice['executable'])
return false;
if($aservice['custom_php_service_status_command'] <> "") {
$_cmd=explode(';', $aservice['custom_php_service_status_command']);
foreach($_cmd as $_acmd) {
if($_acmd) eval('$rc='.$_acmd.';');
}
return $rc;
}
*/
return is_process_running($aservice['executable']) ? true : false;
}
}