mirror of
https://github.com/nextcloud/all-in-one.git
synced 2025-12-20 06:26:57 +00:00
Merge pull request #2784 from nextcloud/enh/noid/modify-postgresql.conf
only modify postgresql.conf if it exists
This commit is contained in:
commit
3beba99734
1 changed files with 12 additions and 9 deletions
|
|
@ -146,6 +146,8 @@ if ! [ -f "$DATADIR/PG_VERSION" ] && ! [ -f "$DUMP_FILE" ]; then
|
||||||
rm -rf "${DATADIR:?}/"*
|
rm -rf "${DATADIR:?}/"*
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Modify postgresql.conf
|
||||||
|
if [ -f "/var/lib/postgresql/data/postgresql.conf" ]; then
|
||||||
echo "Setting max connections..."
|
echo "Setting max connections..."
|
||||||
MEMORY=$(awk '/MemTotal/ {printf "%d", $2/1024}' /proc/meminfo)
|
MEMORY=$(awk '/MemTotal/ {printf "%d", $2/1024}' /proc/meminfo)
|
||||||
MAX_CONNECTIONS=$((MEMORY/50+3))
|
MAX_CONNECTIONS=$((MEMORY/50+3))
|
||||||
|
|
@ -157,6 +159,7 @@ fi
|
||||||
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
|
||||||
trap 'true' SIGINT SIGTERM
|
trap 'true' SIGINT SIGTERM
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue