From eee88f670b738c6e0dc384552144a0be3999b5a6 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 7 Apr 2023 02:11:01 +0200 Subject: [PATCH] max_memory_limit_mysql.sh: add support for MariaDB --- conf/mysql_credetials.conf.sample | 13 +++++++++++++ max_memory_limit_mysql.sh | 4 +++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/conf/mysql_credetials.conf.sample b/conf/mysql_credetials.conf.sample index 575a713..580fa80 100644 --- a/conf/mysql_credetials.conf.sample +++ b/conf/mysql_credetials.conf.sample @@ -7,6 +7,19 @@ # - MySQL / MariaDB / Percona credentials +# - basename_mysql_daemon +# - +# - (Base)Name of the MySQL Daemon +# - +# - Example +# - basename_mysql_daemon=mysqld +# - basename_mysql_daemon=mariadbd +# - +# - Defaults to +# - basename_mysql_daemon=mysqld +# - +#basename_mysql_daemon=mysqld + # - mysql_credential_args # - # - Giving password on command line is insecure an sind mysql 5.5 diff --git a/max_memory_limit_mysql.sh b/max_memory_limit_mysql.sh index e856b9e..e76108d 100755 --- a/max_memory_limit_mysql.sh +++ b/max_memory_limit_mysql.sh @@ -13,12 +13,14 @@ tmp_log_file="$(mktemp)" #DEFAULT_ACTION='create' DEFAULT_MYSQL_CREDENTIAL_ARGS="--login-path=local" +DEFAULT_BASENAME_MYSQL_DEAMON=mysqld if [[ -f "$conf_file" ]]; then source "$conf_file" > $tmp_log_file 2>&1 fi [[ -n "$mysql_credential_args" ]] || mysql_credential_args="$DEFAULT_MYSQL_CREDENTIAL_ARGS" +[[ -n "$basename_mysql_daemon" ]] || basename_mysql_daemon="$DEFAULT_BASENAME_MYSQL_DEAMON" declare -i key_buffer_size @@ -236,7 +238,7 @@ max_memory_allocated=`expr $key_buffer_size \ max_memory_allocated_mb=`expr $max_memory_allocated / 1024 / 1024` -cur_memory_usage=`ps -ylC mysqld | grep mysqld | awk '{print$8}'` +cur_memory_usage=`ps -ylC $basename_mysql_daemon | grep $basename_mysql_daemon | awk '{print$8}'` cur_memory_usage_mb=`echo "scale=0; $cur_memory_usage/1024+1" | bc -l`