CC-2694: Create command line program for viewing/dumping log files
-install + upgrade script -add liquidsoap to log files
This commit is contained in:
parent
5f56538bff
commit
f9a7ebcab5
3 changed files with 45 additions and 4 deletions
|
@ -359,6 +359,10 @@ class AirtimeInstall
|
|||
echo "* Installing airtime-user".PHP_EOL;
|
||||
$dir = AirtimeInstall::CONF_DIR_BINARIES."/utils/airtime-user";
|
||||
exec("ln -s $dir /usr/bin/airtime-user");
|
||||
|
||||
echo "* Installing airtime-log".PHP_EOL;
|
||||
$dir = AirtimeInstall::CONF_DIR_BINARIES."/utils/airtime-log";
|
||||
exec("ln -s $dir /usr/bin/airtime-log");
|
||||
}
|
||||
|
||||
public static function RemoveSymlinks()
|
||||
|
@ -366,6 +370,8 @@ class AirtimeInstall
|
|||
exec("rm -f /usr/bin/airtime-import");
|
||||
exec("rm -f /usr/bin/airtime-update-db-settings");
|
||||
exec("rm -f /usr/bin/airtime-check-system");
|
||||
exec("rm -f /usr/bin/airtime-user");
|
||||
exec("rm -f /usr/bin/airtime-log");
|
||||
}
|
||||
|
||||
public static function InstallPhpCode()
|
||||
|
|
|
@ -17,7 +17,8 @@ require_once 'propel/runtime/lib/Propel.php';
|
|||
Propel::init(__DIR__."/../../../airtime_mvc/application/configs/airtime-conf.php");
|
||||
|
||||
class AirtimeInstall{
|
||||
|
||||
const CONF_DIR_BINARIES = "/usr/lib/airtime";
|
||||
|
||||
public static function SetDefaultTimezone()
|
||||
{
|
||||
global $CC_DBC;
|
||||
|
@ -32,6 +33,20 @@ class AirtimeInstall{
|
|||
return true;
|
||||
}
|
||||
|
||||
public static function GetUtilsSrcDir()
|
||||
{
|
||||
return __DIR__."/../../../utils";
|
||||
}
|
||||
|
||||
public static function CreateSymlinksToUtils()
|
||||
{
|
||||
echo "* Installing airtime-log".PHP_EOL;
|
||||
$dir = AirtimeInstall::CONF_DIR_BINARIES."/utils/airtime-log";
|
||||
copy(AirtimeInstall::GetUtilsSrcDir()."/airtime-log.php", AirtimeInstall::CONF_DIR_BINARIES."/utils/airtime-log.php");
|
||||
|
||||
exec("ln -s $dir /usr/bin/airtime-log");
|
||||
}
|
||||
|
||||
public static function SetDefaultStreamSetting()
|
||||
{
|
||||
global $CC_DBC;
|
||||
|
@ -384,6 +399,7 @@ class AirtimeIni200{
|
|||
|
||||
Airtime200Upgrade::connectToDatabase();
|
||||
AirtimeInstall::SetDefaultTimezone();
|
||||
AirtimeInstall::CreateSymlinksToUtils();
|
||||
|
||||
/* Airtime 2.0.0 starts interpreting all database times in UTC format. Prior to this, all the times
|
||||
* were stored using the local time zone. Let's convert to UTC time. */
|
||||
|
|
|
@ -1,12 +1,16 @@
|
|||
<?php
|
||||
|
||||
set_include_path(__DIR__.'/../airtime_mvc/library' . PATH_SEPARATOR . get_include_path());
|
||||
$airtimeIni = getAirtimeConf();
|
||||
$airtime_base_dir = $airtimeIni['general']['airtime_dir'];
|
||||
|
||||
set_include_path("$airtime_base_dir/library" . PATH_SEPARATOR . get_include_path());
|
||||
require_once('Zend/Loader/Autoloader.php');
|
||||
$autoloader = Zend_Loader_Autoloader::getInstance();
|
||||
|
||||
$log_files = array("media-monitor" => "/var/log/airtime/media-monitor/media-monitor.log",
|
||||
"recorder" => "/var/log/airtime/show-recorder/show-recorder.log",
|
||||
"playout" => "/var/log/airtime/pypo/pypo.log",
|
||||
"liquidsoap" => "/var/log/airtime/pypo-liquidsoap/ls_script.log",
|
||||
"web" => "/var/log/airtime/zendphp.log");
|
||||
|
||||
array_filter($log_files, "file_exists");
|
||||
|
@ -39,7 +43,7 @@ function viewSpecificLog($key){
|
|||
|
||||
function dumpAllLogs(){
|
||||
$dateStr = gmdate("Y-m-d-H-i-s");
|
||||
$filename = __DIR__."/airtime-log-all-$dateStr.tgz";
|
||||
$filename = "/tmp/airtime-log-all-$dateStr.tgz";
|
||||
echo "Creating Airtime logs tgz file at $filename";
|
||||
$command = "tar cfz $filename /var/log/airtime 2>/dev/null";
|
||||
exec($command);
|
||||
|
@ -50,7 +54,7 @@ function dumpSpecificLog($key){
|
|||
|
||||
if (isKeyValid($key)){
|
||||
$dateStr = gmdate("Y-m-d-H-i-s");
|
||||
$filename = __DIR__."/airtime-log-$key-$dateStr.tgz";
|
||||
$filename = "/tmp/airtime-log-$key-$dateStr.tgz";
|
||||
echo "Creating Airtime logs tgz file at $filename";
|
||||
$dir = dirname($log_files[$key]);
|
||||
$command = "tar cfz $filename $dir 2>/dev/null";
|
||||
|
@ -75,6 +79,18 @@ function tailSpecificLog($key){
|
|||
} else printUsage();
|
||||
}
|
||||
|
||||
function getAirtimeConf()
|
||||
{
|
||||
$ini = parse_ini_file("/etc/airtime/airtime.conf", true);
|
||||
|
||||
if ($ini === false){
|
||||
echo "Error reading /etc/airtime/airtime.conf.".PHP_EOL;
|
||||
exit;
|
||||
}
|
||||
|
||||
return $ini;
|
||||
}
|
||||
|
||||
try {
|
||||
$keys = implode("|", array_keys($log_files));
|
||||
$opts = new Zend_Console_Getopt(
|
||||
|
@ -113,6 +129,9 @@ if (isset($opts->v)){
|
|||
} else {
|
||||
tailSpecificLog($opts->t);
|
||||
}
|
||||
} else {
|
||||
printUsage();
|
||||
exit;
|
||||
}
|
||||
|
||||
echo PHP_EOL;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue