From 9be5dcfd8abecc74d3bdbc460a626afda64110bc Mon Sep 17 00:00:00 2001 From: midoks Date: Thu, 17 Aug 2023 00:47:29 +0800 Subject: [PATCH] Update index.py --- plugins/mongodb/index.py | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/plugins/mongodb/index.py b/plugins/mongodb/index.py index 832311137..1a7f03cad 100755 --- a/plugins/mongodb/index.py +++ b/plugins/mongodb/index.py @@ -172,13 +172,7 @@ def runInfo(): result["version"] = serverStatus['version'] result["uptime"] = serverStatus['uptime'] - result['db_path'] = '/var/lib/mongo' - - if os.path.exists("/var/lib/mongodb"): - result['db_path'] = '/var/lib/mongodb' - - if mw.isAppleSystem(): - result['db_path'] = getServerDir() + "/data" + result['db_path'] = getServerDir() + "/data" result["connections"] = serverStatus['connections']['current'] if 'catalogStats' in serverStatus: @@ -192,11 +186,7 @@ def initdStatus(): if mw.isAppleSystem(): return "Apple Computer does not support" - shell_cmd = 'systemctl status mongod | grep loaded | grep "enabled;"' - - if os.path.exists("/usr/lib/systemd/system/mongodb.service"): - shell_cmd = 'systemctl status mongodb | grep loaded | grep "enabled;"' - + shell_cmd = 'systemctl status mongodb | grep loaded | grep "enabled;"' data = mw.execShell(shell_cmd) if data[0] == '': return 'fail' @@ -207,10 +197,7 @@ def initdInstall(): if mw.isAppleSystem(): return "Apple Computer does not support" - if os.path.exists("/usr/lib/systemd/system/mongodb.service"): - mw.execShell('systemctl enable mongodb') - else: - mw.execShell('systemctl enable mongod') + mw.execShell('systemctl enable mongodb') return 'ok' @@ -218,10 +205,7 @@ def initdUinstall(): if mw.isAppleSystem(): return "Apple Computer does not support" - if os.path.exists("/usr/lib/systemd/system/mongodb.service"): - mw.execShell('systemctl disable mongodb') - else: - mw.execShell('systemctl disable mongod') + mw.execShell('systemctl disable mongodb') return 'ok'