fix: if icecast is not running, livestream.service is constantly restarting, but that does not show. make sure a service that is contantly "auto-restart" is show as such
This commit is contained in:
@@ -14,11 +14,17 @@ function service_status($name) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
$op = shell_exec("sudo systemctl status ".$name." | grep Active | grep ' active\| activating\|running\|waiting\|start'");
|
||||
if(strlen($op) > 0) {
|
||||
echo "<span style='color:green'>(active)</span>";
|
||||
$op = shell_exec("sudo systemctl status ".$name." | grep Active");
|
||||
if (stripos($op, " active (running)")) {
|
||||
echo "<span style='color:green'>(active)</span>";
|
||||
} elseif (stripos($op, " inactive ")) {
|
||||
echo "<span style='color:#fc6603'>(inactive)</span>";
|
||||
} else {
|
||||
echo "<span style='color:#fc6603'>(inactive)</span>";
|
||||
$status = "ERROR";
|
||||
if (preg_match("/(\S*)\s*\((\S+)\)/", $op, $matches)) {
|
||||
$status = $matches[1]. " [" . $matches[2] . "]";
|
||||
}
|
||||
echo "<span style='color:red'>($status)</span>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user