fix setting max connections

Signed-off-by: szaimen <szaimen@e.mail.de>
This commit is contained in:
szaimen 2022-08-22 22:45:03 +02:00
parent 20892c2d40
commit 2e1e53e9d3
3 changed files with 8 additions and 3 deletions

View file

@ -113,7 +113,9 @@ fi
echo "Setting max connections..."
MEMORY=$(mawk '/MemTotal/ {printf "%d", $2/1024}' /proc/meminfo)
MAX_CONNECTIONS=$((MEMORY/50+3))
sed -i "s|^max_connections =.*|max_connections = $MAX_CONNECTIONS|" "/var/lib/postgresql/data/postgresql.conf"
if [ -n "$MAX_CONNECTIONS" ]; then
sed -i "s|^max_connections =.*|max_connections = $MAX_CONNECTIONS|" "/var/lib/postgresql/data/postgresql.conf"
fi
# Catch docker stop attempts
trap 'true' SIGINT SIGTERM