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)
import Port import subprocess import time print("start memcached ...") prot = 11211 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:/pdlib-resin-3.0.14/httpd -Xmn256m -Xms512m -Xmx1024m -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8001 -conf conf/resin-product.conf" cmd = "D:/pdlib-resin-3.0.14/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 = 60 if Port.isExist(prot): Port.kill(prot); time.sleep(3) proc = subprocess.Popen(cmd, shell=True) print("resin ok !")
def killForm(): k = maxFailTime while not Port.isExist(prot) and k > 0: time.sleep(1) k -= 1 Port.simplekillByName(prot, method)
import Port import subprocess import threading import time prot = 81 cmd = "C:/command/resin-3.1.9/httpd" method = "httpd" maxFailTime = 60 def killForm(): k = maxFailTime while not Port.isExist(prot) and k > 0: time.sleep(1) k -= 1 Port.simplekillByName(prot, method) if Port.isExist(prot): Port.kill(prot); threading.Thread(target=killForm).start() proc = subprocess.Popen(cmd, shell=True)
def clean(): k = maxFailTime while not Port.isExist(prot) and k > 0: time.sleep(1) k -= 1 Proc.killByName(method)