global $df;
global $touch;
global $server;
global $msg_type_info;
require_once $lib_path . '/common.php';
if ($argc != 2) {
    echo "cmd err: {$argv['0']} the_local_machine_name\n";
    echo "eg: {$argv['0']} hp-compute-10\n";
    echo "where the_local_machine_name is defined in {$etc_path}/RCMResourcecollector.conf.php\n";
    exit;
}
// make sure we are the right local ip.
$my_name = $argv[1];
$my_info = $cluster_list[$my_name];
$my_ip = $my_info['ip'];
$local_ip_list = get_local_ip();
if (!in_array($my_ip, $local_ip_list)) {
    echo "your input host name is: {$my_name}\n";
    echo "{$my_name}'s pre-defined ip in {$etc_path}/RCMResourcecollector.conf.php is " . $my_ip . "\n";
    echo "which is NOT find locally by ifconfig:\n";
    print_r($local_ip_list);
    exit;
}
$log_tag = 'get_local_infos';
$my_tag = $my_name . '.' . $log_tag;
$my_pidfile = $pid_path . '/' . $my_tag . '.pid';
// like: hp-mgmt-1.get_local_infos.pid
$my_alivefile = $pid_path . '/' . $my_tag . '.alive';
$pid = getmypid();
$cmd = "{$echo} '{$pid}' > {$my_pidfile} 2>/dev/null";
exec($cmd);
예제 #2
0
    exec("ipconfig", $out, $stats);
    var_dump($out);
    foreach ($out as $row) {
        if (strstr($row, "IP") && strstr($row, ":") && !strstr($row, "IPv6")) {
            $tmpIp = explode(":", $row);
            if (preg_match($preg, trim($tmpIp[1]))) {
                return trim($tmpIp[1]);
            }
        }
    }
    //获取操作系统为linux类型的本机IP真实地址
    exec("ifconfig", $out, $stats);
    if (isset($out[1]) && strstr($out[1], 'addr:')) {
        $tmpArray = explode(":", $out[1]);
        $tmpIp = explode(" ", $tmpArray[1]);
        if (preg_match($preg, trim($tmpIp[0]))) {
            return trim($tmpIp[0]);
        }
    }
    return '127.0.0.1';
}
$content = "<meta http-equiv=Content-Type content=\"text/html;charset=utf-8\">" . file_get_contents("http://localhost/SinaWeibo/CheckLog/TestSiteConfigAll.php?Logname=" . $_GET['Logname']);
//将内容写入到以时间命名的html文件中
$file = date('YmdHis');
$filename = "D:\\Sina\\wamp\\wamp\\www\\Report\\" . $file . "_" . $_GET['Logname'] . ".html";
if (file_put_contents($filename, $content)) {
    echo "success<br>";
    echo "goto File: <a href=http://" . get_local_ip() . "/Report/" . $file . "_" . $_GET['Logname'] . ".html>" . $file . "_" . $_GET['Logname'] . ".html</a>";
} else {
    echo 'fail';
}
예제 #3
0
    }
    //获取操作系统为linux类型的本机IP真实地址
    exec("ifconfig", $out, $stats);
    if (isset($out[1]) && strstr($out[1], 'addr:')) {
        $tmpArray = explode(":", $out[1]);
        $tmpIp = explode(" ", $tmpArray[1]);
        if (preg_match($preg, trim($tmpIp[0]))) {
            return trim($tmpIp[0]);
        }
    }
    return '127.0.0.1';
}
$array = array();
//1、先打开要操作的目录,并用一个变量指向它
//打开当前目录下的目录pic下的子目录common。
$handler = opendir("D:\\Sina\\wamp\\wamp\\www\\Report\\");
//2、循环的读取目录下的所有文件
/* 其中$filename = readdir($handler)是每次循环的时候将读取的文件名赋值给$filename,为了不陷于死循环,所以还要让$filename !== false。一定要用!==,因为如果某个文件名如果叫’0′,或者某些被系统认为是代表false,用!=就会停止循环 */
while (($filename = readdir($handler)) !== false) {
    // 3、目录下都会有两个文件,名字为’.'和‘..’,不要对他们进行操作
    if ($filename != '.' && $filename != '..') {
        // 4、进行处理
        array_push($array, $filename);
    }
}
//5、关闭目录
closedir($handler);
//var_dump($array);
foreach ($array as $ar) {
    echo "<a href=http://" . get_local_ip() . "/Report/" . $ar . ">" . $ar . "</a><br>";
}
예제 #4
0
                return trim($tmpIp[1]);
            }
        }
    }
    //获取操作系统为linux类型的本机IP真实地址
    exec("ifconfig", $out, $stats);
    if (isset($out[1]) && strstr($out[1], 'addr:')) {
        $tmpArray = explode(":", $out[1]);
        $tmpIp = explode(" ", $tmpArray[1]);
        if (preg_match($preg, trim($tmpIp[0]))) {
            return trim($tmpIp[0]);
        }
    }
    return '127.0.0.1';
}
echo "<a href=http://" . get_local_ip() . "//SinaWeibo/CheckLog/TestEntrance.html><strong>[返回主页]</strong></a><br>";
echo "Checking the LogFile <strong>" . $_GET['Logname'] . "</strong> begin..." . "<br>";
echo "<br>";
$logName = "D:\\Sina\\wamp\\wamp\\www\\LogFile\\" . $_GET['Logname'];
$checknoavailable = new checkTodayLog($logName);
$checknoavailable->FindNoAvailableBlock();
echo "*******************************************<br>";
echo "*******************************************<br>";
$check = new checkTodayLog($logName);
$a = $check->FindNewTemplate();
$tbody = array();
$newslist = array();
$mutiplematch = array();
$notemplatematch = array();
$alreadyupdate = array();
$canbeupdate = array();