From ee4ee1341f9d2a52354ce9e0c0c3407b0894ce71 Mon Sep 17 00:00:00 2001 From: midoks Date: Thu, 5 May 2022 04:51:28 +0800 Subject: [PATCH] Update index.py --- plugins/mongodb/index.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/plugins/mongodb/index.py b/plugins/mongodb/index.py index ea6bfd534..e0f9bdca1 100755 --- a/plugins/mongodb/index.py +++ b/plugins/mongodb/index.py @@ -130,6 +130,24 @@ def stop(): def reload(): + if os.path.exists("/tmp/mongodb-27017.sock"): + mw.execShell('rm -rf ' + "/tmp/mongodb-27017.sock") + if mw.isAppleSystem(): + file = initDreplace() + data = mw.execShell(file + ' reload') + if data[1] == '': + return 'ok' + return 'fail' + + data = mw.execShell('systemctl reload mongod') + if data[1] == '': + return 'ok' + return 'fail' + + +def restart(): + if os.path.exists("/tmp/mongodb-27017.sock"): + mw.execShell('rm -rf ' + "/tmp/mongodb-27017.sock") if mw.isAppleSystem(): file = initDreplace() data = mw.execShell(file + ' reload')