[CODE] add information if host is up (via ping)
This commit is contained in:
parent
dab8525bae
commit
8446cfe206
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
.AppleDouble
|
17
index.php
17
index.php
|
@ -10,6 +10,8 @@ if (isset($_GET['wake'])) {
|
||||||
$return = shell_exec('wakeonlan '.$_GET['wake']);
|
$return = shell_exec('wakeonlan '.$_GET['wake']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$clients = ["nuc6i5-host"=>"b8:ae:ed:ec:18:f7",
|
||||||
|
"magrathea" =>"60:03:08:9c:25:6a"];
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
|
@ -35,6 +37,9 @@ if (isset($_GET['wake'])) {
|
||||||
a, a:visited {
|
a, a:visited {
|
||||||
color: blue;
|
color: blue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.red { color: red; }
|
||||||
|
.green { color: green; }
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
@ -46,7 +51,17 @@ if (isset($_GET['wake'])) {
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<p>I can wake up the following clients:</p>
|
<p>I can wake up the following clients:</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="?wake=b8:ae:ed:ec:18:f7">nuc6i5-host (b8:ae:ed:ec:18:f7)</a></li>
|
<?php foreach ($clients as $name=>$mac) : ?>
|
||||||
|
<li>
|
||||||
|
<a href="?wake=<?php echo $mac ?>"><?php echo $name ?> (<?php echo $mac ?>)</a>
|
||||||
|
<?php $foo = array(); $status; exec("ping -c 1 ".$name.".fra80", $foo, $status); ?>
|
||||||
|
<?php if (!$status) : ?>
|
||||||
|
<span class="green">•</span> online
|
||||||
|
<?php else : ?>
|
||||||
|
<span class="red">•</span> offline
|
||||||
|
<?php endif; ?>
|
||||||
|
</li>
|
||||||
|
<?php endforeach; ?>
|
||||||
</ul>
|
</ul>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
Reference in a new issue