mirror of
https://github.com/blakeblackshear/frigate.git
synced 2025-09-26 19:41:29 +08:00
Fix ulimit setting (#19087)
* Fix setting both hard and soft limits * Clarify warning
This commit is contained in:
@@ -14,14 +14,14 @@ TARGET_HARD_LIMIT=65536
|
|||||||
if [ "$current_soft_limit" -lt "$TARGET_SOFT_LIMIT" ]; then
|
if [ "$current_soft_limit" -lt "$TARGET_SOFT_LIMIT" ]; then
|
||||||
# Attempt to set both soft and hard limits to the new value
|
# Attempt to set both soft and hard limits to the new value
|
||||||
# This requires sufficient privileges (e.g., running as root in the container)
|
# This requires sufficient privileges (e.g., running as root in the container)
|
||||||
if ulimit -n "$TARGET_SOFT_LIMIT:$TARGET_HARD_LIMIT"; then
|
if ulimit -Hn "$TARGET_HARD" && ulimit -Sn "$TARGET_SOFT"; then
|
||||||
new_soft_limit=$(ulimit -Sn)
|
new_soft_limit=$(ulimit -Sn)
|
||||||
new_hard_limit=$(ulimit -Hn)
|
new_hard_limit=$(ulimit -Hn)
|
||||||
|
|
||||||
if [ "$new_soft_limit" -ne "$TARGET_SOFT_LIMIT" ] || [ "$new_hard_limit" -ne "$TARGET_HARD_LIMIT" ]; then
|
if [ "$new_soft_limit" -ne "$TARGET_SOFT_LIMIT" ] || [ "$new_hard_limit" -ne "$TARGET_HARD_LIMIT" ]; then
|
||||||
echo "Warning: Limits were set, but not to the exact target values. Check system constraints."
|
echo "Warning: Nofile limits were set, but not to the exact target values."
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "Error: Failed to set new nofile limits."
|
echo "Warning: Failed to set new nofile limits."
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
Reference in New Issue
Block a user