Update index.py

pull/405/head
midoks 2 years ago
parent 98e1c2ae8f
commit a0b362e691
  1. 52
      plugins/docker/index.py

@ -77,65 +77,17 @@ def status():
def initDreplace():
file_tpl = getInitDTpl()
service_path = os.path.dirname(os.getcwd())
initD_path = getServerDir() + '/init.d'
if not os.path.exists(initD_path):
os.mkdir(initD_path)
# file_bin = initD_path + '/' + getPluginName()
# initd replace
# if not os.path.exists(file_bin):
# content = mw.readFile(file_tpl)
# content = content.replace('{$SERVER_PATH}', service_path)
# mw.writeFile(file_bin, content)
# mw.execShell('chmod +x ' + file_bin)
# log
# dataLog = getServerDir() + '/data'
# if not os.path.exists(dataLog):
# mw.execShell('chmod +x ' + file_bin)
# # config replace
# dst_conf = getServerDir() + '/redis.conf'
# dst_conf_init = getServerDir() + '/init.pl'
# if not os.path.exists(dst_conf_init):
# conf_content = mw.readFile(getConfTpl())
# conf_content = conf_content.replace('{$SERVER_PATH}', service_path)
# conf_content = conf_content.replace(
# '{$REDIS_PASS}', mw.getRandomString(10))
# mw.writeFile(dst_conf, conf_content)
# mw.writeFile(dst_conf_init, 'ok')
# # systemd
# systemDir = mw.systemdCfgDir()
# systemService = systemDir + '/redis.service'
# systemServiceTpl = getPluginDir() + '/init.d/redis.service.tpl'
# if os.path.exists(systemDir) and not os.path.exists(systemService):
# service_path = mw.getServerDir()
# se_content = mw.readFile(systemServiceTpl)
# se_content = se_content.replace('{$SERVER_PATH}', service_path)
# mw.writeFile(systemService, se_content)
# mw.execShell('systemctl daemon-reload')
return file_bin
return ''
def dockerOp(method):
file = initDreplace()
if not mw.isAppleSystem():
data = mw.execShell('systemctl ' + method + ' redis')
data = mw.execShell('systemctl ' + method + ' docker')
if data[1] == '':
return 'ok'
return data[1]
data = mw.execShell(file + ' start')
if data[1] == '':
return 'ok'
return 'fail'

Loading…
Cancel
Save