From fdc5d901d160e1061f8e3e7d446b60d218b90ca3 Mon Sep 17 00:00:00 2001 From: midoks Date: Sat, 5 Jan 2019 15:14:57 +0800 Subject: [PATCH] Update index.py --- plugins/mysql/index.py | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/plugins/mysql/index.py b/plugins/mysql/index.py index 55f89adfa..b9eb7ded9 100755 --- a/plugins/mysql/index.py +++ b/plugins/mysql/index.py @@ -102,36 +102,35 @@ def status(): return 'start' +def myOp(method): + init_file = initDreplace() + data = public.execShell(init_file + ' ' + method) + if data[1] == '': + return 'ok' + return data[1] + + def start(): + return myOp('start') - init_file = initDreplace() - initMysql = getServerDir() + '/scripts/mysql_install_db ' + '--basedir=' + \ - getServerDir() + ' --datadir=' + getServerDir() + '/data' - return initMysql - - cmd = getServerDir() + '/bin/mysqld_safe ' + getServerDir() + \ - '/conf/my.cnf ' + '--user=mysql&' - # return cmd - data = public.execShell(cmd) - if data[0] == '': - return 'stop' - return data[0] +# def stop(): +# data = public.execShell( +# "ps -ef|grep mysql |grep -v grep |grep -v python |awk '{print $2}' | xargs kill -9") +# if data[0] == '': +# return 'ok' +# return 'fail' def stop(): - data = public.execShell( - "ps -ef|grep mysql |grep -v grep |grep -v python |awk '{print $2}' | xargs kill -9") - if data[0] == '': - return 'ok' - return 'fail' + return myOp('stop') def restart(): - return 'ok' + return myOp('restart') def reload(): - return 'ok' + return myOp('reload') def initdStatus():