#!/usr/bin/python
# -*- coding:utf-8 -*-
import os
import time
import socket,re
import datetime
dt=str(datetime.datetime.now()).replace(':','').replace('-','').replace(' ','')[0:14]
ip ='10.30.12.25'
f=open('/bea/user_projects/domains/zx_domain/bin/rs'+dt+'.log','w')
for portpc in range(1,7):
time.sleep( 1 )
server = socket.socket()
server.settimeout(1)
port='701'+str(portpc)
appserver='zxServer0'+str(portpc)
cmd='/bea/user_projects/domains/zx_domain/bin/rs.sh 0'+str(portpc)
res = server.connect_ex((ip,int(port)))
if res == 0:
print >>f,'%s---%s:ok' % (ip,port)
else:
print >>f,'%s---%s:not,needrestart' % (ip, port)
cont = os.popen(cmd).read()
print >>f,cont
server.close()
f.close()