Exemplo n.º 1
0
 public function disableWinbind()
 {
     $cmd_args = " --update --disablewinbind";
     $ret = PsExecute(CMD_AUTHCONFIG . $cmd_args);
     return $ret;
 }
Exemplo n.º 2
0
?>
<?
function PsExecute($command, $timeout = 20, $sleep = 2) {
  exec($command.'>/dev/null & echo $!',$op);
  $pid = (int)$op[0];
  $timer = 0;
  while ($timer<$timeout) {
    sleep($sleep);
    $timer += $sleep;
    if (PsEnded($pid)) return true;
  }
  PsKill($pid);
  return false;
}
function PsEnded($pid) {
  exec("ps -eo pid|grep $pid",$output);
  foreach ($output as $list) if (trim($list)==$pid) return false;
  return true;
}
function PsKill($pid) {
  exec("kill -9 $pid");
}
if (PsExecute("/usr/local/emhttp/webGui/scripts/notify -s 'unRAID SMTP Test' -d 'Test message received!' -i 'alert' -t")) {
  $result = exec("tail -3 /var/log/syslog|awk '/sSMTP/ {getline;print}'|cut -d']' -f2|cut -d'(' -f1");
  $color = strpos($result, 'Sent mail') ? 'green' : 'red';
  echo "Test result<span class='$color'>$result</span>";
} else {
  echo "Test result<span class='red'>: No reply from mail server</span>";
}
?>
 echo "\tFetching IP-Addresses of interface " . $name . "\n";
 $networkinterface = new Networkinterface(false, $router->getRouterId(), $name);
 if ($networkinterface->fetch()) {
     $iplist = new Iplist($networkinterface->getNetworkinterfaceId());
     foreach ($iplist->getIplist() as $ip) {
         echo "\t\tWorking with " . $ip->getIp() . "\n";
         $xml_array = array();
         $ping = false;
         $return = array();
         if ($ip->getNetwork()->getIpv() == 6) {
             $command = "ping6 -c {$ping_count} -w " . ($ping_count + 1) * $ping_timeout . " -W {$ping_timeout} -I {$network_connection_ipv6_interface} " . $ip->getIp();
         } elseif ($ip->getNetwork()->getIpv() == 4) {
             $command = "ping -c {$ping_count} -w " . ($ping_count + 1) * $ping_timeout . " -W {$ping_timeout} " . $ip->getIp();
         }
         echo "\t\t\t" . $command . "\n";
         PsExecute($command, $ping_hard_timeout, 1);
         //fetch crawl data from router
         $return = array();
         if ($ip->getNetwork()->getIpv() == 6) {
             $command = "curl -s --max-time {$crawl_timeout} -g http://[" . $ip->getIp() . "%25\$(cat /sys/class/net/{$network_connection_ipv6_interface}/ifindex)]/node.data";
         } elseif ($ip->getNetwork()->getIpv() == 4) {
             $command = "curl -s --max-time {$crawl_timeout} -g http://" . $ip->getIp() . "/node.data";
         }
         echo "\t\t\t" . $command . "\n";
         exec($command, $return);
         $return_string = "";
         foreach ($return as $string) {
             $return_string .= $string;
         }
         //store the crawl data into the database if the router is not offline
         if (!empty($return_string)) {