Update index.py

pull/624/head
Mr Chen 9 months ago
parent fce7fe4fe3
commit 418734eb31
  1. 18
      plugins/fail2ban/index.py

@ -142,15 +142,15 @@ def initDreplace():
# mw.execShell('chmod +x ' + file_bin) # mw.execShell('chmod +x ' + file_bin)
# systemd # systemd
systemDir = mw.systemdCfgDir() # systemDir = mw.systemdCfgDir()
systemService = systemDir + '/' + getPluginName() + '.service' # systemService = systemDir + '/' + getPluginName() + '.service'
if os.path.exists(systemDir) and not os.path.exists(systemService): # if os.path.exists(systemDir) and not os.path.exists(systemService):
systemServiceTpl = getPluginDir() + '/init.d/' + getPluginName() + '.service.tpl' # systemServiceTpl = getPluginDir() + '/init.d/' + getPluginName() + '.service.tpl'
service_path = mw.getServerDir() # service_path = mw.getServerDir()
se_content = mw.readFile(systemServiceTpl) # se_content = mw.readFile(systemServiceTpl)
se_content = se_content.replace('{$SERVER_PATH}', service_path) # se_content = se_content.replace('{$SERVER_PATH}', service_path)
mw.writeFile(systemService, se_content) # mw.writeFile(systemService, se_content)
mw.execShell('systemctl daemon-reload') # mw.execShell('systemctl daemon-reload')
return file_bin return file_bin

Loading…
Cancel
Save