rs.py
#!/usr/bin/python
# -*- coding:utf-8 -*-
import os
import time
import socket,re
import datetime
dt=str(datetime.datetime.now()).replace(':','').replace('-','').replace(' ','')[0:8]
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('%s---%s:ok' % (ip,port),file = f)
else:
print('%s---%s:not,needrestart' % (ip, port), file = f)
cont = os.popen(cmd).read()
print(cont)
server.close()
f.close()
rs.sh
echo $#
if [[ $# > 0 ]]; then
echo zxServer$1
ps -ef|grep zxServer$1 |grep java|awk '{print $2}'|xargs -i kill -9 {}
export USER_MEM_ARGS="-Xms4096m -Xmx4096m -XX:MaxPermSize=1024m"
cd /bea/user_projects/domains/zx_domain/bin
nohup ./startManagedWebLogic.sh zxServer$1 "http://10.30.12.25:7010" >/bea/user_projects/domains/zx_domain/bin/logs/zxServer$1.log &
#tail -f /bea/user_projects/domains/zx_domain/bin/logs/zxServer$1.log
fi
look.py
#!/usr/bin/python
# -*- coding:utf-8 -*-
import os
import time
import socket,re
ip ='10.30.12.25'
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('%s---%s:ok' % (ip,port))
else:
print('%s---%s:not' % (ip, port))
server.close()