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