From 7654b44879aa5bffe4d0c8d8dbac96c9c78e97dd Mon Sep 17 00:00:00 2001 From: midoks Date: Mon, 1 Aug 2022 13:34:40 +0800 Subject: [PATCH] Update install.sh --- plugins/openresty/install.sh | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/plugins/openresty/install.sh b/plugins/openresty/install.sh index 589f4583c..8c7673ba6 100755 --- a/plugins/openresty/install.sh +++ b/plugins/openresty/install.sh @@ -27,6 +27,25 @@ fi # cd /www/server/mdserver-web/plugins/openresty && /bin/bash install.sh install 1.21.4.1 Install_openresty() { + # ----- 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 [ "${cpuCore}" != "1" ] && [ "${MEM_INFO}" != "0" ];then + if [ "${cpuCore}" -gt "${MEM_INFO}" ];then + cpuCore="${MEM_INFO}" + fi + else + cpuCore="1" + fi + # ----- cpu end ------ + mkdir -p ${openrestyDir} echo '正在安装脚本文件...' > $install_tmp @@ -45,7 +64,7 @@ Install_openresty() --with-http_slice_module \ --with-http_stub_status_module - make && make install && make clean + make -j${cpuCore} && make install && make clean if [ -d $serverPath/openresty ];then echo "${VERSION}" > $serverPath/openresty/version.pl