From 32f58e6323cab2a8ac6f4198a370c3fca67bcf84 Mon Sep 17 00:00:00 2001 From: Mr Chen Date: Sun, 28 Jul 2024 19:36:37 +0800 Subject: [PATCH] Update index.py --- plugins/fail2ban/index.py | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/plugins/fail2ban/index.py b/plugins/fail2ban/index.py index 889ca8a10..19a4a81fb 100755 --- a/plugins/fail2ban/index.py +++ b/plugins/fail2ban/index.py @@ -97,23 +97,17 @@ def readConfigTpl(): content = contentReplace(content) return mw.returnJson(True, 'ok', content) +def f2bDir(): + return '/run/fail2ban' + def getPidFile(): - file = getConf() - content = mw.readFile(file) - rep = r'pidfile\s*(.*)' - tmp = re.search(rep, content) - return tmp.groups()[0].strip() + f2dir = f2bDir() + return f2dir+'/fail2ban.pid' def status(): pid_file = getPidFile() if not os.path.exists(pid_file): return 'stop' - - # data = mw.execShell( - # "ps aux|grep redis |grep -v grep | grep -v python | grep -v mdserver-web | awk '{print $2}'") - - # if data[0] == '': - # return 'stop' return 'start' def contentReplace(content):