diff --git a/plugins/mysql-yum/index.py b/plugins/mysql-yum/index.py index 3065f798a..a88588d06 100755 --- a/plugins/mysql-yum/index.py +++ b/plugins/mysql-yum/index.py @@ -504,11 +504,38 @@ def my8cmd(version, method): isInited = initMysql8Data() if not isInited: - mw.execShell('systemctl start ' + getPluginName()) + if not mw.isSupportSystemctl(): + cmd_init_start = init_file + ' start' + subprocess.Popen(cmd_init_start, stdout=subprocess.PIPE, shell=True, + bufsize=4096, stderr=subprocess.PIPE) + + time.sleep(6) + else: + mw.execShell('systemctl start '+getPluginName()) + + for x in range(10): + mydb_status = process_status() + if mydb_status == 'start': + initMysql8Pwd() + break + time.sleep(1) + initMysql8Pwd() - mw.execShell('systemctl stop ' + getPluginName()) - mw.execShell('systemctl ' + method + ' ' + getPluginName()) + if not mw.isSupportSystemctl(): + cmd_init_stop = init_file + ' stop' + subprocess.Popen(cmd_init_stop, stdout=subprocess.PIPE, shell=True, + bufsize=4096, stderr=subprocess.PIPE) + time.sleep(3) + else: + mw.execShell('systemctl stop ' + getPluginName()) + + if not mw.isSupportSystemctl(): + sub = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True, + bufsize=4096, stderr=subprocess.PIPE) + sub.wait(5) + else: + mw.execShell('systemctl ' + method + ' '+getPluginName()) return 'ok' except Exception as e: return str(e) diff --git a/plugins/mysql/index.py b/plugins/mysql/index.py index df34c10eb..0a323739a 100755 --- a/plugins/mysql/index.py +++ b/plugins/mysql/index.py @@ -617,11 +617,7 @@ def my8cmd(version, method): try: if version == '5.7': isInited = initMysql57Data() - elif version == '8.0': - isInited = initMysql8Data() - elif version == '8.2': - isInited = initMysql8Data() - elif version == '8.3': + elif mw.inArray(['8.0','8.1','8.2','8.3','8.4'], version): isInited = initMysql8Data() if not isInited: