#!/usr/bin/php -q require_once '/usr/local/emhttp/webGui/include/ColorCoding.php'; array_shift($argv); $colorize = ($argv[0] == 'logs'); if ($colorize) echo "
ErrorWarningSystemArrayLogin
\n"; $handle = popen('/usr/bin/docker '.implode(' ',$argv),'r'); while (!feof($handle)) { $line = fgets($handle); if ($colorize) { $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).""; } else { echo $line; } flush(); } pclose($handle); ?>