From 8bf3b1b6523113b9e7d53cb134cc02c51fe415e7 Mon Sep 17 00:00:00 2001 From: robbt Date: Fri, 17 Apr 2020 21:54:26 -0400 Subject: [PATCH 1/2] Simplified check to work under Debian using the fact that a pid is greater than 0 --- airtime_mvc/build/airtime-setup/load.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/airtime_mvc/build/airtime-setup/load.php b/airtime_mvc/build/airtime-setup/load.php index d926cbb25..985d6f8d6 100644 --- a/airtime_mvc/build/airtime-setup/load.php +++ b/airtime_mvc/build/airtime-setup/load.php @@ -114,7 +114,7 @@ function checkRMQConnection() { */ function checkAnalyzerService() { exec("pgrep -f -u www-data airtime_analyzer", $out, $status); - if (array_key_exists(0, $out) && $status == 0) { + if (($out > 0) && $status == 0) { return posix_kill(rtrim($out[0]), 0); } return $status == 0; @@ -127,7 +127,7 @@ function checkAnalyzerService() { */ function checkPlayoutService() { exec("pgrep -f -u www-data airtime-playout", $out, $status); - if (array_key_exists(0, $out) && $status == 0) { + if ($out > 0) { return posix_kill(rtrim($out[0]), 0); } return $status == 0; @@ -140,7 +140,7 @@ function checkPlayoutService() { */ function checkLiquidsoapService() { exec("pgrep -f -u www-data airtime-liquidsoap", $out, $status); - if (array_key_exists(0, $out) && $status == 0) { + if ($out > 0) { return posix_kill(rtrim($out[0]), 0); } return $status == 0; From 141d7586c24a87cb72ce0968caffa2349e958b7b Mon Sep 17 00:00:00 2001 From: robbt Date: Fri, 17 Apr 2020 22:04:15 -0400 Subject: [PATCH 2/2] removed hardcoded www-data user for pgrep check --- airtime_mvc/build/airtime-setup/load.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/airtime_mvc/build/airtime-setup/load.php b/airtime_mvc/build/airtime-setup/load.php index 985d6f8d6..fb8ee7213 100644 --- a/airtime_mvc/build/airtime-setup/load.php +++ b/airtime_mvc/build/airtime-setup/load.php @@ -113,7 +113,7 @@ function checkRMQConnection() { * @return boolean true if airtime-analyzer is running */ function checkAnalyzerService() { - exec("pgrep -f -u www-data airtime_analyzer", $out, $status); + exec("pgrep -f airtime_analyzer", $out, $status); if (($out > 0) && $status == 0) { return posix_kill(rtrim($out[0]), 0); } @@ -126,7 +126,7 @@ function checkAnalyzerService() { * @return boolean true if airtime-playout is running */ function checkPlayoutService() { - exec("pgrep -f -u www-data airtime-playout", $out, $status); + exec("pgrep -f airtime-playout", $out, $status); if ($out > 0) { return posix_kill(rtrim($out[0]), 0); } @@ -139,7 +139,7 @@ function checkPlayoutService() { * @return boolean true if airtime-liquidsoap is running */ function checkLiquidsoapService() { - exec("pgrep -f -u www-data airtime-liquidsoap", $out, $status); + exec("pgrep -f airtime-liquidsoap", $out, $status); if ($out > 0) { return posix_kill(rtrim($out[0]), 0); }