Merge pull request #13575 from antobinary/worker_rlimit_nofile

build: Set worker_rlimit_nofile only once in nginx.conf
This commit is contained in:
Anton Georgiev 2021-10-26 15:48:01 -04:00 committed by GitHub
commit 473bb7bd41
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -124,7 +124,12 @@ fi
sed -i 's/worker_connections 768/worker_connections 4000/g' /etc/nginx/nginx.conf
if ! grep "worker_rlimit_nofile 10000;" /etc/nginx/nginx.conf; then
if grep "worker_rlimit_nofile" /etc/nginx/nginx.conf; then
num=$(grep worker_rlimit_nofile /etc/nginx/nginx.conf | grep -o '[0-9]*')
if [[ "$num" -lt 10000 ]]; then
sed -i 's/worker_rlimit_nofile [0-9 ]*;/worker_rlimit_nofile 10000;/g' /etc/nginx/nginx.conf
fi
else
sed -i 's/events {/worker_rlimit_nofile 10000;\n\nevents {/g' /etc/nginx/nginx.conf
fi