From bfb5dc4e588d1718f65f11a66ad571f0c8374249 Mon Sep 17 00:00:00 2001 From: martin Date: Thu, 2 Jun 2011 11:09:49 -0400 Subject: [PATCH] cc-2055: switch to init.d -need to verify is pid from pid file actually is running (for airtime-check-system) --- install/airtime-upgrade.php | 13 ++++++++----- utils/airtime-check-system.php | 28 ++++++++++++++++++---------- 2 files changed, 26 insertions(+), 15 deletions(-) diff --git a/install/airtime-upgrade.php b/install/airtime-upgrade.php index 1acd0a5e0..eca71d4da 100644 --- a/install/airtime-upgrade.php +++ b/install/airtime-upgrade.php @@ -63,16 +63,19 @@ if (!$version){ echo "******************************** Update Begin *********************************".PHP_EOL; -if(strcmp($version, "1.7.0") < 0) { +//convert strings like 1.9.0-devel to 1.9.0 +$version = substr($version, 0, 5); + +if (strcmp($version, "1.7.0") < 0){ system("php ".__DIR__."/upgrades/airtime-1.7/airtime-upgrade.php"); } -if(strcmp($version, "1.8.0") < 0) { +if (strcmp($version, "1.8.0") < 0){ system("php ".__DIR__."/upgrades/airtime-1.8/airtime-upgrade.php"); } -if(strcmp($version, "1.8.1") < 0) { +if (strcmp($version, "1.8.1") < 0){ system("php ".__DIR__."/upgrades/airtime-1.8.1/airtime-upgrade.php"); } -if(strcmp($version, "1.8.2") < 0) { +if (strcmp($version, "1.8.2") < 0){ system("php ".__DIR__."/upgrades/airtime-1.8.2/airtime-upgrade.php"); } if (strcmp($version, "1.9.0") < 0){ @@ -83,7 +86,7 @@ if (strcmp($version, "1.9.0") < 0){ //set the new version in the database. $sql = "DELETE FROM cc_pref WHERE keystr = 'system_version'"; $CC_DBC->query($sql); -$sql = "INSERT INTO cc_pref (keystr, valstr) VALUES ('system_version', '1.8.2')"; +$sql = "INSERT INTO cc_pref (keystr, valstr) VALUES ('system_version', '1.9.0-devel')"; $CC_DBC->query($sql); diff --git a/utils/airtime-check-system.php b/utils/airtime-check-system.php index a866f6a9a..ac51b9b0f 100644 --- a/utils/airtime-check-system.php +++ b/utils/airtime-check-system.php @@ -87,14 +87,18 @@ class AirtimeCheck { if (file_exists($filename)){ //first get pid - $pid = trim(file_get_contents($filename)); + $potential_pid = trim(file_get_contents($filename)); + //check if the pid is actually live + if (file_exists("/proc/$potential_pid")){ + $pid = $potential_pid; - //now lets get the running time - $lastModified = filemtime($filename); - $currentTime = time(); + //now lets get the running time + $lastModified = filemtime($filename); + $currentTime = time(); - $numSecondsRunning = $currentTime - $lastModified; + $numSecondsRunning = $currentTime - $lastModified; + } } output_status("PLAYOUT_ENGINE_PROCESS_ID", $pid); @@ -126,14 +130,18 @@ class AirtimeCheck { if (file_exists($filename)){ //first get pid - $pid = trim(file_get_contents($filename)); + $potential_pid = trim(file_get_contents($filename)); + //check if the pid is actually live + if (file_exists("/proc/$potential_pid")){ + $pid = $potential_pid; - //now lets get the running time - $lastModified = filemtime($filename); - $currentTime = time(); + //now lets get the running time + $lastModified = filemtime($filename); + $currentTime = time(); - $numSecondsRunning = $currentTime - $lastModified; + $numSecondsRunning = $currentTime - $lastModified; + } } output_status("LIQUIDSOAP_PROCESS_ID", $pid);