def clean(): k = maxFailTime while not Port.isExist(prot) and k > 0: time.sleep(1) k -= 1 Proc.killByName(method)
cmd = "D:/memcached.exe" if Port.isExist(prot): Port.kill(prot); time.sleep(3) proc = subprocess.Popen(cmd, shell=True) print("memcached ok !") print("start resin ...") prot = 8082 # cmd = "D:/resin-3.1.9/httpd -Xmn256m -Xms512m -Xmx1024m -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8001 -conf conf/resin-product-svn.conf" cmd = "D:/resin-3.1.9/httpd -Xmn256m -Xms512m -Xmx1024m -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8001 -conf conf/resin-product-svn.conf" method = "httpd" maxFailTime = 3*60 killFormTime = 100 def clean(): k = maxFailTime while not Port.isExist(prot) and k > 0: time.sleep(1) k -= 1 Proc.killByName(method) Proc.killByName(method) if Port.isExist(prot): Port.kill(prot) threading.Thread(target=clean).start() proc = subprocess.Popen(cmd, shell=True) print("resin ok !")