Report on airtime-celery service in status

Adds celery checks to /?config and /systemstatus for completeness' sake.

Fixes #138
This commit is contained in:
Lucas Bickel 2017-04-01 10:25:12 +02:00
parent e0f88ba808
commit 516f98dfcf
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 www-data airtime-celery", $out, $status);
if (array_key_exists(0, $out) && $status == 0) {
return posix_kill(rtrim($out[0]), 0);
}
return $status == 0;
}