!/usr/bin/env python
check lvs port
import socket,sys
host = '172.16.54.94'
port = '9999'
def conn(host,port):
try:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((str(host),int(port)))
s.settimeout(2)
print 'Server port %s OK!' % port
sys.exit(0)
except Exception:
print 'Server %s port %s not connect!' % (host,port)
sys.exit(1)
s.close()
conn(host,port)