From 22ae62a557c589dd243d1f9d521684067d5295da Mon Sep 17 00:00:00 2001 From: Code-Egg Date: Fri, 9 Aug 2024 11:31:49 +0800 Subject: [PATCH] add mem check for centos9 --- ols1clk.sh | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/ols1clk.sh b/ols1clk.sh index eeb0495..dcf0767 100755 --- a/ols1clk.sh +++ b/ols1clk.sh @@ -412,6 +412,22 @@ function update_centos_hashlib fi } +function get_memory +{ + RAM_KB=$(grep "MemTotal" /proc/meminfo | awk '{print $2}') +} + +function check_memory +{ + if [ "${OSNAMEVER}" = 'CENTOS9' ]; then + get_memory + if [ "$RAM_KB" -lt "1800000" ]; then + echoR 'remi package needs at least 2GB RAM to install it. Exit!' + exit 1 + fi + fi +} + function install_ols_centos { local action=install @@ -428,7 +444,6 @@ function install_ols_centos if [ "${OSNAMEVER}" = 'CENTOS9' ]; then echoB "${FPACE} - add remi repo" - silent ${YUM} -y $action https://rpms.remirepo.net/enterprise/remi-release-${OSVER}.rpm else echoB "${FPACE} - add epel repo" silent ${YUM} -y $action epel-release @@ -2316,6 +2331,7 @@ function main_init_check check_os check_cur_status check_dbversion_param + check_memory } function main_init_package