Fix mariadb-admin path
This commit is contained in:
@@ -540,28 +540,33 @@ class WOInfoController(CementBaseController):
|
|||||||
@expose(hide=True)
|
@expose(hide=True)
|
||||||
def info_mysql(self):
|
def info_mysql(self):
|
||||||
"""Display MySQL information"""
|
"""Display MySQL information"""
|
||||||
version = os.popen("/usr/bin/mysql -V | awk '{print($5)}' | "
|
if os.path.exists('/usr/bin/mariadb'):
|
||||||
|
mariadb_exec = "/usr/bin/mariadb"
|
||||||
|
else:
|
||||||
|
mariadb_exec = "/usr/bin/mysql"
|
||||||
|
version = os.popen(f"{mariadb_exec} -V |"
|
||||||
|
"awk '{print($5)}' | "
|
||||||
"cut -d ',' "
|
"cut -d ',' "
|
||||||
"-f1 | tr -d '\n'").read()
|
"-f1 | tr -d '\n'").read()
|
||||||
host = "localhost"
|
host = "localhost"
|
||||||
port = os.popen("/usr/bin/mysql -e \"show variables\" | "
|
port = os.popen(f"{mariadb_exec} -e \"show variables\" | "
|
||||||
"/bin/grep ^port | awk "
|
"/bin/grep ^port | awk "
|
||||||
"'{print($2)}' | tr -d '\n'").read()
|
"'{print($2)}' | tr -d '\n'").read()
|
||||||
wait_timeout = os.popen("/usr/bin/mysql -e \"show variables\" | grep "
|
wait_timeout = os.popen(f"{mariadb_exec} -e \"show variables\" | grep "
|
||||||
"^wait_timeout | awk '{print($2)}' | "
|
"^wait_timeout | awk '{print($2)}' | "
|
||||||
"tr -d '\n'").read()
|
"tr -d '\n'").read()
|
||||||
interactive_timeout = os.popen("/usr/bin/mysql -e "
|
interactive_timeout = os.popen(f"{mariadb_exec} -e "
|
||||||
"\"show variables\" | grep "
|
"\"show variables\" | grep "
|
||||||
"^interactive_timeout | awk "
|
"^interactive_timeout | awk "
|
||||||
"'{print($2)}' | tr -d '\n'").read()
|
"'{print($2)}' | tr -d '\n'").read()
|
||||||
max_used_connections = os.popen("/usr/bin/mysql -e "
|
max_used_connections = os.popen(f"{mariadb_exec} - e "
|
||||||
"\"show global status\" | "
|
"\"show global status\" | "
|
||||||
"grep Max_used_connections | awk "
|
"grep Max_used_connections | awk "
|
||||||
"'{print($2)}' | tr -d '\n'").read()
|
"'{print($2)}' | tr -d '\n'").read()
|
||||||
datadir = os.popen("/usr/bin/mysql -e \"show variables\" | "
|
datadir = os.popen(f"{mariadb_exec} -e \"show variables\" | "
|
||||||
"/bin/grep datadir | awk"
|
"/bin/grep datadir | awk"
|
||||||
" '{print($2)}' | tr -d '\n'").read()
|
" '{print($2)}' | tr -d '\n'").read()
|
||||||
socket = os.popen("/usr/bin/mysql -e \"show variables\" | "
|
socket = os.popen(f"{mariadb_exec} -e \"show variables\" | "
|
||||||
"/bin/grep \"^socket\" | "
|
"/bin/grep \"^socket\" | "
|
||||||
"awk '{print($2)}' | tr -d '\n'").read()
|
"awk '{print($2)}' | tr -d '\n'").read()
|
||||||
data = dict(version=version, host=host, port=port,
|
data = dict(version=version, host=host, port=port,
|
||||||
@@ -593,7 +598,11 @@ class WOInfoController(CementBaseController):
|
|||||||
self.info_php()
|
self.info_php()
|
||||||
|
|
||||||
if pargs.mysql:
|
if pargs.mysql:
|
||||||
if WOShellExec.cmd_exec(self, "/usr/bin/mysqladmin ping"):
|
if os.path.exists('/usr/bin/mariadb-admin'):
|
||||||
|
mariadb_admin = "/usr/bin/mariadb-admin"
|
||||||
|
else:
|
||||||
|
mariadb_admin = "/usr/bin/mysqladmin"
|
||||||
|
if WOShellExec.cmd_exec(self, f"{mariadb_admin} ping"):
|
||||||
self.info_mysql()
|
self.info_mysql()
|
||||||
else:
|
else:
|
||||||
Log.info(self, "MySQL is not installed")
|
Log.info(self, "MySQL is not installed")
|
||||||
|
|||||||
Reference in New Issue
Block a user