def killForm(): k = maxFailTime while not Port.isExist(prot) and k > 0: time.sleep(1) k -= 1 if Port.isExist(prot): print("kill httpd.exe") Port.simplekillByName(prot, method)
def killForm(): k = maxFailTime while not Port.isExist(prot) and k > 0: time.sleep(1) k -= 1 Port.simplekillByName(prot, method)
import time import socket hostName = socket.gethostname() if hostName == 'lym' : prot = 83 cmd = "D:/resin-3.1.9/httpd -conf conf/struts1_core_test.conf" else: prot = 81 cmd = "C:/command/resin-3.1.9/httpd -conf conf/struts1_core_test.conf" method = "httpd" maxFailTime = 6000 def killForm(): k = maxFailTime while not Port.isExist(prot) and k > 0: time.sleep(1) k -= 1 if Port.isExist(prot): print("kill httpd.exe") Port.simplekillByName(prot, method) Port.simplekillByName(prot, method) Port.kill(prot) threading.Thread(target=killForm).start() proc = subprocess.Popen(cmd, shell=True)