mirror of
https://github.com/blakeblackshear/frigate.git
synced 2024-11-26 19:06:11 +01:00
142641b387
* Restrict nginx to 4 processes if more are available * Fix bash * Different sed structure * Limit ffmpeg thread counts for secondary ffmpeg processes * Add up / down keyboard shortcut
27 lines
663 B
Plaintext
Executable File
27 lines
663 B
Plaintext
Executable File
#!/command/with-contenv bash
|
|
# shellcheck shell=bash
|
|
# Start the NGINX service
|
|
|
|
set -o errexit -o nounset -o pipefail
|
|
|
|
# Logs should be sent to stdout so that s6 can collect them
|
|
|
|
echo "[INFO] Starting NGINX..."
|
|
|
|
function set_worker_processes() {
|
|
# Capture number of assigned CPUs to calculate worker processes
|
|
local proc_count
|
|
|
|
if proc_count=$(nproc --all) && [[ $proc_count -gt 4 ]]; then
|
|
proc_count=4;
|
|
fi
|
|
|
|
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
|