From 458c68ee4be3f781ae7091be80551b209035466a Mon Sep 17 00:00:00 2001 From: midoks Date: Sun, 19 Jun 2022 18:03:18 +0800 Subject: [PATCH] Update index.py --- plugins/mysql/index.py | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/plugins/mysql/index.py b/plugins/mysql/index.py index 16b4ef28d..09669dec4 100755 --- a/plugins/mysql/index.py +++ b/plugins/mysql/index.py @@ -419,6 +419,8 @@ def myOp(version, method): bufsize=4096, stderr=subprocess.PIPE) if initData == 0: initMysqlPwd() + + data = mw.execShell('systemctl ' + method + ' mysql') return 'ok' except Exception as e: return str(e) @@ -452,15 +454,8 @@ def my8cmd(version, method): time.sleep(3) my8cmd(version, method) else: - if method == "stop": - mw.execShell(cmd) - mw.execShell( - "ps -ef|grep mysql|grep -v grep|grep -v py|awk '{print $2}'|xargs kill") - return "ok" - - sub = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True, - bufsize=4096, stderr=subprocess.PIPE) - sub.wait(5) + data = mw.execShell('systemctl ' + method + ' mysql') + return 'ok' except Exception as e: return str(e)