Merge pull request #190 from h88782481/dev

Dev
pull/191/head
Mr Chen 3 years ago committed by GitHub
commit f95d25f080
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      class/core/mw.py
  2. 26
      plugins/openresty/index.py

@ -167,13 +167,13 @@ def restartWeb():
# systemd
systemd = '/lib/systemd/system/openresty.service'
if os.path.exists(systemd):
execShell('systemctl restart openresty')
execShell('systemctl reload openresty')
return True
# initd
initd = getServerDir() + '/openresty/init.d/openresty'
if os.path.exists(initd):
execShell(initd + ' ' + 'restart')
execShell(initd + ' ' + 'reload')
return True
return False

@ -215,6 +215,29 @@ def restyOp(method):
return 'ok'
return data[1]
def submit_restart1():
mw.execShell('systemctl restart openresty')
def submit_restart2(file):
mw.execShell(file + ' restart')
def restyOp_restart():
file = initDreplace()
# 启动时,先检查一下配置文件
check = getServerDir() + "/bin/openresty -t"
check_data = mw.execShell(check)
if not check_data[1].find('test is successful') > -1:
return check_data[1]
if not mw.isAppleSystem():
threading.Timer(5,submit_restart1,args=()).start()
#submit_restart1()
return 'ok'
threading.Timer(5,submit_restart2,args=(file)).start()
#submit_restart2(file)
return 'ok'
def start():
return restyOp('start')
@ -225,13 +248,14 @@ def stop():
def restart():
return restyOp('restart')
return restyOp_restart()
def reload():
return restyOp('reload')
def initdStatus():
if mw.isAppleSystem():

Loading…
Cancel
Save