max_memory_limit_mysql.sh: add support for MariaDB

This commit is contained in:
root 2023-04-07 02:11:01 +02:00
parent 1de383a138
commit eee88f670b
2 changed files with 16 additions and 1 deletions

View File

@ -7,6 +7,19 @@
# - MySQL / MariaDB / Percona credentials # - 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 # - mysql_credential_args
# - # -
# - Giving password on command line is insecure an sind mysql 5.5 # - Giving password on command line is insecure an sind mysql 5.5

View File

@ -13,12 +13,14 @@ tmp_log_file="$(mktemp)"
#DEFAULT_ACTION='create' #DEFAULT_ACTION='create'
DEFAULT_MYSQL_CREDENTIAL_ARGS="--login-path=local" DEFAULT_MYSQL_CREDENTIAL_ARGS="--login-path=local"
DEFAULT_BASENAME_MYSQL_DEAMON=mysqld
if [[ -f "$conf_file" ]]; then if [[ -f "$conf_file" ]]; then
source "$conf_file" > $tmp_log_file 2>&1 source "$conf_file" > $tmp_log_file 2>&1
fi fi
[[ -n "$mysql_credential_args" ]] || mysql_credential_args="$DEFAULT_MYSQL_CREDENTIAL_ARGS" [[ -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 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` 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` cur_memory_usage_mb=`echo "scale=0; $cur_memory_usage/1024+1" | bc -l`