threadr.lostcave.ddnss.de/strassenkind.php

49 lines
1.7 KiB
PHP
Raw Normal View History

2020-02-12 04:24:26 +01:00
<!DOCTYPE html>
<!--
<?php
echo "Getting status commands...";
$status_file_name = "commands_status.conf";
$status_file = fopen($status_file_name, "r") or die("Could not read file $status_file_name. Aborting.");
$status_commands = explode(PHP_EOL, fread($status_file, filesize($status_file_name)));
fclose($status_file);
echo "Done.";
echo "Getting ondemand commands...";
$ondemand_file_name = "commands_ondemand.conf";
$ondemand_file = fopen($ondemand_file_name, "r") or die("Could not read file $ondemand_file_name. Aborting.");
$ondemand_commands = explode(PHP_EOL, fread($ondemand_file, filesize($ondemand_file_name)));
fclose($ondemand_file);
echo "Done.";
?>
2020-02-12 04:45:55 +01:00
-->
<html>
<head>
2020-02-12 05:26:21 +01:00
<title> Strassenkind Server Status Page </title>
2020-02-12 04:45:55 +01:00
<link rel="stylesheet" type="text/css" href="./common/content/style.css" />
2020-02-12 05:26:21 +01:00
<?php
if (!isset($_POST['ondemand'])) {
echo "<meta http-equiv=\"refresh\" content=\"20\" />";
}
?>
2020-02-12 04:45:55 +01:00
</head>
2020-02-12 05:26:21 +01:00
<body class="status_page">
<h1> Strassenkind Server Status </h1>
<hr />
<?php
// run ondemand command list if demanded
if (isset($_POST['ondemand'])) {
foreach ($ondemand_commands as $command) {
echo "<!-- $command\n";
$output = system($command);
echo "-->\n<pre class=\"commandLine\"> $command </pre>\n<pre class=\"commandLine\"> $output </pre>\n<hr />";
}
} else {
//run status command list otherwise
foreach ($status_commands as $command) {
echo "<!-- $command\n";
$output = system($command);
echo "-->\n<pre class=\"commandLine\"> $command </pre>\n<pre class=\"commandLine\"> $output </pre>\n<hr />";
}
}
?>
2020-02-12 04:45:55 +01:00
</body>
</html>