Update index.py

pull/109/head
midoks 3 years ago
parent 8577dc713d
commit c18547a404
  1. 40
      plugins/varnish/index.py

@ -81,33 +81,29 @@ def status():
return 'start' return 'start'
def start(): def vaOp(method):
data = mw.execShell('systemctl start ' + getPluginName()) mw.execShell("systemctl daemon-reload")
data = mw.execShell('systemctl ' + method + ' ' + getPluginName())
if data[1] == '': if data[1] == '':
return 'ok' return 'ok'
return 'fail' return 'fail'
def start():
return vaOp('start')
def stop(): def stop():
data = mw.execShell('systemctl stop ' + getPluginName()) return vaOp('stop')
if data[1] == '':
return 'ok'
return 'fail'
def restart(): def restart():
data = mw.execShell('systemctl restart ' + getPluginName()) return vaOp('restart')
if data[1] == '':
return 'ok'
return 'fail'
def reload(): def reload():
# file = initDreplace() # file = initDreplace()
data = mw.execShell('systemctl reload ' + getPluginName()) return vaOp('reload')
if data[1] == '':
return 'ok'
return 'fail'
def runInfo(): def runInfo():
@ -138,9 +134,8 @@ def readConfigTpl():
def initdStatus(): def initdStatus():
if not app_debug: if mw.isAppleSystem():
if mw.isAppleSystem(): return "Apple Computer does not support"
return "Apple Computer does not support"
shell_cmd = 'systemctl status ' + \ shell_cmd = 'systemctl status ' + \
getPluginName() + ' | grep loaded | grep "enabled;"' getPluginName() + ' | grep loaded | grep "enabled;"'
@ -151,19 +146,16 @@ def initdStatus():
def initdInstall(): def initdInstall():
import shutil if mw.isAppleSystem():
if not app_debug: return "Apple Computer does not support"
if mw.isAppleSystem():
return "Apple Computer does not support"
mw.execShell('systemctl enable ' + getPluginName()) mw.execShell('systemctl enable ' + getPluginName())
return 'ok' return 'ok'
def initdUinstall(): def initdUinstall():
if not app_debug: if mw.isAppleSystem():
if mw.isAppleSystem(): return "Apple Computer does not support"
return "Apple Computer does not support"
mw.execShell('systemctl disable ' + getPluginName()) mw.execShell('systemctl disable ' + getPluginName())
return 'ok' return 'ok'

Loading…
Cancel
Save