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:
frederik
2025-03-14 16:34:32 +01:00
parent 6d5b18e959
commit fea7ff0e0c
+10 -4
View File
@@ -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>";
}
}
?>