mirror of
https://github.com/nextcloud/all-in-one.git
synced 2025-12-19 22:16:49 +00:00
only modify postgresql.conf if it exists
Signed-off-by: Simon L <szaimen@e.mail.de>
This commit is contained in:
parent
e22afe6031
commit
75a32f6cf0
1 changed files with 12 additions and 9 deletions
|
|
@ -146,16 +146,19 @@ if ! [ -f "$DATADIR/PG_VERSION" ] && ! [ -f "$DUMP_FILE" ]; then
|
||||||
rm -rf "${DATADIR:?}/"*
|
rm -rf "${DATADIR:?}/"*
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Setting max connections..."
|
# Modify postgresql.conf
|
||||||
MEMORY=$(awk '/MemTotal/ {printf "%d", $2/1024}' /proc/meminfo)
|
if [ -f "/var/lib/postgresql/data/postgresql.conf" ]; then
|
||||||
MAX_CONNECTIONS=$((MEMORY/50+3))
|
echo "Setting max connections..."
|
||||||
if [ -n "$MAX_CONNECTIONS" ]; then
|
MEMORY=$(awk '/MemTotal/ {printf "%d", $2/1024}' /proc/meminfo)
|
||||||
|
MAX_CONNECTIONS=$((MEMORY/50+3))
|
||||||
|
if [ -n "$MAX_CONNECTIONS" ]; then
|
||||||
sed -i "s|^max_connections =.*|max_connections = $MAX_CONNECTIONS|" "/var/lib/postgresql/data/postgresql.conf"
|
sed -i "s|^max_connections =.*|max_connections = $MAX_CONNECTIONS|" "/var/lib/postgresql/data/postgresql.conf"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Modify conf
|
# Modify conf
|
||||||
if grep -q "#log_checkpoints" /var/lib/postgresql/data/postgresql.conf; then
|
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
|
sed -i 's|#log_checkpoints.*|log_checkpoints = off|' /var/lib/postgresql/data/postgresql.conf
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Catch docker stop attempts
|
# Catch docker stop attempts
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue