Update index.py

pull/632/head
Mr Chen 10 months ago
parent b350747eab
commit 3e9b47cbf3
  1. 13
      plugins/swap/index.py

@ -79,7 +79,7 @@ def getInitDTpl():
def initDreplace():
file_tpl = getInitDTpl()
service_path = os.path.dirname(os.getcwd())
service_path = mw.getServerDir()
initD_path = getServerDir() + '/init.d'
if not os.path.exists(initD_path):
@ -101,12 +101,11 @@ def initDreplace():
if os.path.exists(systemDir) and not os.path.exists(systemService):
swapon_bin = mw.execShell('which swapon')[0].strip()
swapoff_bin = mw.execShell('which swapoff')[0].strip()
service_path = mw.getServerDir()
se_content = mw.readFile(systemServiceTpl)
se_content = se_content.replace('{$SERVER_PATH}', service_path)
se_content = se_content.replace('{$SWAPON_BIN}', swapon_bin)
se_content = se_content.replace('{$SWAPOFF_BIN}', swapoff_bin)
mw.writeFile(systemService, se_content)
content = mw.readFile(systemServiceTpl)
content = content.replace('{$SERVER_PATH}', service_path)
content = content.replace('{$SWAPON_BIN}', swapon_bin)
content = content.replace('{$SWAPOFF_BIN}', swapoff_bin)
mw.writeFile(systemService, content)
mw.execShell('systemctl daemon-reload')
return file_bin

Loading…
Cancel
Save