From 876957693eff5c85541ccffcce06eb884d83b4ff Mon Sep 17 00:00:00 2001 From: midoks Date: Mon, 1 Aug 2022 13:02:21 +0800 Subject: [PATCH] Update install.sh --- plugins/mysql/versions/5.7/install.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/plugins/mysql/versions/5.7/install.sh b/plugins/mysql/versions/5.7/install.sh index de237fb09..0a41990e3 100755 --- a/plugins/mysql/versions/5.7/install.sh +++ b/plugins/mysql/versions/5.7/install.sh @@ -38,18 +38,24 @@ Install_mysql() touch /var/log/mariadb/mariadb.log fi + # ----- cpu start ------ if [ -z "${cpuCore}" ]; then cpuCore="1" fi + if [ -f /proc/cpuinfo ];then + cpuCore=`cat /proc/cpuinfo | grep "processor" | wc -l` + fi + MEM_INFO=$(free -m|grep Mem|awk '{printf("%.f",($2)/1024)}') - if [ "${MEM_INFO}" != "0" ];then - if [ "${cpuCore}" -lt "${MEM_INFO}" ];then + if [ "${cpuCore}" != "1" ] &&& [ "${MEM_INFO}" != "0" ];then + if [ "${cpuCore}" -gt "${MEM_INFO}" ];then cpuCore="${MEM_INFO}" fi else cpuCore="1" fi + # ----- cpu end ------ cd $serverPath/mdserver-web/plugins/mysql/lib && /bin/bash rpcgen.sh