php502功能优化

pull/118/head
midoks 3 years ago
parent d06648ff47
commit 2663fd7a99
  1. 60
      task.py

@ -432,34 +432,40 @@ def startPHPVersion(version):
def checkPHPVersion(version): def checkPHPVersion(version):
try: try:
url = 'http://127.0.0.1/phpfpm_status_' + version url = 'http://127.0.0.1/phpfpm_status_' + version
result = mw.httpGet(url) result = mw.httpGet(url, 1)
# print(version,result) if result.find('timed out'):
# 检查openresty raise
if result.find('Bad Gateway') != -1: except Exception as e:
return False url = 'http://' + mw.getLocalIp() + '/phpfpm_status_' + version
if result.find('HTTP Error 404: Not Found') != -1: result = mw.httpGet(url, 1)
return False else:
result = 'Bad Gateway'
# 检查Web服务是否启动
if result.find('Connection refused') != -1: # print(version,result)
global isTask # 检查openresty
if os.path.exists(isTask): if result.find('Bad Gateway') != -1:
isStatus = mw.readFile(isTask) return False
if isStatus == 'True': if result.find('HTTP Error 404: Not Found') != -1:
return True return False
# systemd # 检查Web服务是否启动
systemd = '/lib/systemd/system/openresty.service' if result.find('Connection refused') != -1:
if os.path.exists(systemd): global isTask
execShell('systemctl reload openresty') if os.path.exists(isTask):
isStatus = mw.readFile(isTask)
if isStatus == 'True':
return True return True
# initd
initd = '/etc/init.d/openresty' # systemd
if os.path.exists(initd): systemd = '/lib/systemd/system/openresty.service'
os.system(initd + ' reload') if os.path.exists(systemd):
return True execShell('systemctl reload openresty')
except: return True
return True # initd
initd = '/etc/init.d/openresty'
if os.path.exists(initd):
os.system(initd + ' reload')
return True
# --------------------------------------PHP监控 end--------------------------------------------- # # --------------------------------------PHP监控 end--------------------------------------------- #

Loading…
Cancel
Save