⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 testconfig.py

📁 刚才是说明 现在是安装程序在 LINUX环境下进行编程的MPICH安装文件
💻 PY
字号:
#!/usr/bin/env  python"""To run:   testconfig.pyThis script is a work in progress and may change frequently as we workwith users and gain additional insights into how to improve it.This script prints quite a bit of useful information about the host onwhich it runs, incuding some info about its ability to discover othercomputers via local files or dns.  It is here to help us help usersdetect problems with configurations of their computers.  For example,some computers are configured to think of themselves simply as'localhost' with 127.0.0.1 as the IP address.  This might presentproblems if a process on that computer wishes to identify itselfby host and port to a process on another computer.  The process on theother computer would try to contact 'localhost'.If you are having problems getting 2 computers to talk to each other,you might change the array named 'hostnames' below to contain those 2computers and then run the script twice, once on each computer."""from sys    import argvfrom os     import system, unamefrom socket import gethostname, gethostbyname_ex, socketfrom popen2 import popen4hostnames = [              'torvalds.cs.mtsu.edu',              'ccn55.mcs.anl.gov',              'ccn55-66.mcs.anl.gov',              'ccn55-67.mcs.anl.gov',              'ccn55-68.mcs.anl.gov',            ]print "----- checking info for ", gethostname()print "--- uname: "print "   ", uname()print "--- hostbyname info: "print "   ", gethostbyname_ex(gethostname())print "--- remote hosts info"for hostname in hostnames:    print "- hostbyname info for %s: " % hostname    try:        print "    ", gethostbyname_ex(hostname)    except:        print "could not get the scoop "try:    s = socket()    s.bind((gethostname(),0))    s.listen(5)    port = s.getsockname()[1]    t1 = socket()    t1.connect((gethostname(),port))    (s1,s1addr) = s.accept()    print "--- sockets info"    # print "    s1addr      =", s1addr    ## same as s1.peername    print "    s1.peername =", s1.getpeername()    print "    t1.peername =", t1.getpeername()except:    print "** failed to print sockets info"printprint "--- try to print /etc/hosts"try:    f = open('/etc/hosts')    for line in f:        print "   ", line,except:    print "    ** failed to open /etc/hosts"print "--- try to print /etc/resolv.conf"try:    f = open('/etc/resolv.conf')    for line in f:        print "   ", line,except:    print "    ** failed to open /etc/resolv.conf"print "--- try to print /etc/nsswitch.conf"try:    f = open('/etc/nsswitch.conf')    for line in f:        print "   ", line,except:    print "    ** failed to open /etc/nsswitch.conf"print "--- try to run /sbin/ifconfig -a"try:    (sout_serr,sin) = popen4('/sbin/ifconfig -a')    for line in sout_serr:        print "   ", line,except:    print "    ** failed to run /sbin/ifconfig -a"print "----- done checking info for ", gethostname()

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -