AddOn/SystemTest/ping.php hinzugefügt
This commit is contained in:
parent
f9c9c8eefe
commit
286a2a3043
|
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
|
||||
if (pingServer($_GET['SERVER'])) {
|
||||
echo "Server ".$_GET['SERVER']." ist erreichbar.";
|
||||
} else {
|
||||
echo "Server ".$_GET['SERVER']." ist NICHT erreichbar.";
|
||||
}
|
||||
|
||||
|
||||
function pingServer($host, $count = 1)
|
||||
{
|
||||
$output = [];
|
||||
$status = null;
|
||||
|
||||
// Windows oder Unix ping
|
||||
$pingCmd = (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN')
|
||||
? "ping -n {$count} {$host}"
|
||||
: "ping -c {$count} {$host}";
|
||||
|
||||
exec($pingCmd, $output, $status);
|
||||
|
||||
return $status === 0;
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
Loading…
Reference in New Issue