diff --git a/.devilbox/www/htdocs/cnc.php b/.devilbox/www/htdocs/cnc.php index 6a325647..92da0f25 100644 --- a/.devilbox/www/htdocs/cnc.php +++ b/.devilbox/www/htdocs/cnc.php @@ -24,7 +24,6 @@ function run_supervisor_command($command) { ?> exec('supervisorctl -c /etc/supervisor/custom.d/supervisorctl.conf restart watcherd'); sleep(1); loadClass('Helper')->redirect('/cnc.php'); } @@ -49,22 +48,20 @@ function run_supervisor_command($command) { exec('supervisorctl -c /etc/supervisor/custom.d/supervisorctl.conf status watcherd'); - //$status_h = loadClass('Helper')->exec('supervisorctl -c /etc/supervisor/custom.d/supervisorctl.conf status httpd'); $words = preg_split("/\s+/", $status_w); $data_w = array( - 'name' => $words[0], - 'state' => $words[1], - 'pid' => preg_replace('/,$/', '', $words[3]), - 'uptime' => $words[5], + 'name' => isset($words[0]) ? $words[0] : '', + 'state' => isset($words[1]) ? $words[1] : '', + 'pid' => isset($words[3]) ? preg_replace('/,$/', '', $words[3]) : '', + 'uptime' => isset($words[5]) ? $words[5] : '', ); $words = preg_split("/\s+/", $status_h); $data_h = array( - 'name' => $words[0], - 'state' => $words[1], - 'pid' => preg_replace('/,$/', '', $words[3]), - 'uptime' => $words[5], + 'name' => isset($words[0]) ? $words[0] : '', + 'state' => isset($words[1]) ? $words[1] : '', + 'pid' => isset($words[3]) ? preg_replace('/,$/', '', $words[3]) : '', + 'uptime' => isset($words[5]) ? $words[5] : '', ); ?>
' . $output . ''; + echo '
'; + foreach(preg_split("/((\r?\n)|(\r\n?))/", $output) as $line) { + if ( strpos($line, "[ERR]") !== false ) { + echo '' . $line . ''; + } else if ( strpos($line, "[emerg]") !== false ) { + echo '' . $line . ''; + } else if ( strpos($line, "Syntax error") !== false ) { + echo '' . $line . ''; + } else if ( strpos($line, "[WARN]") !== false ) { + echo '' . $line . ''; + } else { + echo $line; + } + echo "\n"; + } + echo ''; ?>
' . $output . ''; + echo '
'; + foreach(preg_split("/((\r?\n)|(\r\n?))/", $output) as $line) { + $pos_info = strpos($line, "[INFO]"); + $pos_ok = strpos($line, "[OK]"); + if ( $pos_ok !== false ) { + echo '' . $line . ''; + } else if ( $pos_info !== false && $pos_info == 0 ) { + echo '' . $line . ''; + } else { + echo $line; + } + echo "\n"; + } + echo ''; ?>