HA Status Scripts

最後更新: 2024-10-17

目錄


PHP

 

server.php

<?
  $output = shell_exec('uptime');
  $output .= shell_exec('ifconfig eth0');
  echo "<pre>$output</pre>";
?>

 

checkstatus.php

<?
  $nic = exec("/sbin/ip route | awk '/^default /{print $5}'");
  $ip = exec("/sbin/ip addr show $nic | awk '/inet /{print $2}'");
  $remote_ip = $_SERVER["REMOTE_ADDR"];
  $uptime = exec("uptime");
  echo $ip . "<br>" . $remote_ip . "<br>" . $uptime;
?>