Update index.py

pull/189/head
JiRan 3 years ago committed by GitHub
parent f22e10a496
commit fd35db3dd8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 26
      plugins/openresty/index.py

@ -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