Merge branch 'feature/celery-status' of https://github.com/radiorabe/libretime into radiorabe-feature/celery-status

This commit is contained in:
Robbt 2018-09-03 18:49:07 -04:00
commit 329d214b25
3 changed files with 58 additions and 2 deletions

View file

@ -54,7 +54,8 @@ function checkExternalServices() {
"analyzer" => checkAnalyzerService(),
"pypo" => checkPlayoutService(),
"liquidsoap" => checkLiquidsoapService(),
"rabbitmq" => checkRMQConnection()
"rabbitmq" => checkRMQConnection(),
"celery" => checkCeleryService(),
);
}
@ -144,3 +145,16 @@ function checkLiquidsoapService() {
}
return $status == 0;
}
/**
* Check if airtime-celery is currently running
*
* @return boolean true if airtime-celery is running
*/
function checkCeleryService() {
exec("pgrep -f -u celery airtime-celery", $out, $status);
if (array_key_exists(0, $out) && $status == 0) {
return posix_kill(rtrim($out[0]), 0);
}
return $status == 0;
}