Merge pull request #2784 from nextcloud/enh/noid/modify-postgresql.conf

only modify postgresql.conf if it exists
This commit is contained in:
Simon L 2023-06-16 15:16:25 +02:00 committed by GitHub
commit 3beba99734
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -146,6 +146,8 @@ if ! [ -f "$DATADIR/PG_VERSION" ] && ! [ -f "$DUMP_FILE" ]; then
rm -rf "${DATADIR:?}/"*
fi
# Modify postgresql.conf
if [ -f "/var/lib/postgresql/data/postgresql.conf" ]; then
echo "Setting max connections..."
MEMORY=$(awk '/MemTotal/ {printf "%d", $2/1024}' /proc/meminfo)
MAX_CONNECTIONS=$((MEMORY/50+3))
@ -157,6 +159,7 @@ fi
if grep -q "#log_checkpoints" /var/lib/postgresql/data/postgresql.conf; then
sed -i 's|#log_checkpoints.*|log_checkpoints = off|' /var/lib/postgresql/data/postgresql.conf
fi
fi
# Catch docker stop attempts
trap 'true' SIGINT SIGTERM