From 2ea807dd0284af16ce1f05526fb1d6f8ad707b39 Mon Sep 17 00:00:00 2001 From: Eric Nemchik Date: Fri, 14 May 2021 13:25:47 -0500 Subject: [PATCH] Use nproc to detect available cpus --- root/etc/cont-init.d/50-config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/root/etc/cont-init.d/50-config b/root/etc/cont-init.d/50-config index a83fb02..8faf2b2 100644 --- a/root/etc/cont-init.d/50-config +++ b/root/etc/cont-init.d/50-config @@ -90,7 +90,7 @@ fi # Set worker_processes if ! grep -q 'worker_processes' /config/nginx/worker_processes.conf; then - WORKER_PROCESSES=$(wc -w < /sys/fs/cgroup/cpuacct/cpuacct.usage_percpu) + WORKER_PROCESSES=$(nproc) echo "Setting worker_processes to ${WORKER_PROCESSES}" echo "# This file is auto-generated only on first start, based on the cpu cores detected. Feel free to change it to any other number or to auto to let nginx handle it automatically.\nworker_processes ${WORKER_PROCESSES};" > /config/nginx/worker_processes.conf fi