mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-11 13:45:25 +03:00
Restrict nginx to 4 processes if more are available
This commit is contained in:
parent
3e6b8c23bc
commit
dfd0649335
@ -8,6 +8,19 @@ set -o errexit -o nounset -o pipefail
|
||||
|
||||
echo "[INFO] Starting NGINX..."
|
||||
|
||||
function set_worker_processes() {
|
||||
# Capture number of assigned CPUs to calculate worker processes
|
||||
local proc_count = $(nproc --all)
|
||||
|
||||
if (proc_count > 4) {
|
||||
proc_count = 4;
|
||||
}
|
||||
|
||||
sed -i "" "s/worker_processes auto;/worker_processes ${proc_count};/" /usr/local/nginx/conf/nginx.conf
|
||||
}
|
||||
|
||||
set_worker_processes
|
||||
|
||||
# Replace the bash process with the NGINX process, redirecting stderr to stdout
|
||||
exec 2>&1
|
||||
exec nginx
|
||||
|
||||
Loading…
Reference in New Issue
Block a user