Files
webgui/plugins/dynamix/scripts/disk_log
bergware e7032eaff3 Update copyright [6]
2005 it is....
2016-06-14 13:31:56 +02:00

30 lines
1.1 KiB
PHP
Executable File

#!/usr/bin/php -q
<?PHP
/* Copyright 2005-2016, Lime Technology
* Copyright 2015-2016, Bergware International.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*/
?>
<?
echo "<p style='text-align:center'><span class='error label'>Error</span><span class='warn label'>Warning</span><span class='system label'>System</span><span class='array label'>Array</span></p>\n";
require_once '/usr/local/emhttp/webGui/include/ColorCoding.php';
$ata = exec("ls -n /sys/block/{$argv[1]}|grep -Po 'ata\d+'");
$dev = $ata ? "${argv[1]}|${ata}[.:]" : $argv[1];
exec("grep -P '$dev' /var/log/syslog", $lines);
foreach ($lines as $line) {
if (strpos($line,'disk_log')!==false) continue;
$span = "span";
foreach ($match as $type) foreach ($type['text'] as $text) if (preg_match("/$text/i",$line)) {$span = "span class='{$type['class']}'"; break 2;}
echo "<$span>".htmlentities($line)."\n</span>";
}
?>