cc-2055: switch to init.d

-need to verify is pid from pid file actually is running
 (for airtime-check-system)
This commit is contained in:
martin 2011-06-02 11:09:49 -04:00
parent 963351c6f2
commit bfb5dc4e58
2 changed files with 26 additions and 15 deletions

View File

@ -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);

View File

@ -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);