mirror of
https://github.com/nextcloud/all-in-one.git
synced 2026-02-13 09:10:21 +00:00
Merge pull request #1018 from nextcloud/enh/noid/wait-for-database
wait for the database startup correctly
This commit is contained in:
commit
df92b4bf61
1 changed files with 6 additions and 1 deletions
|
|
@ -11,7 +11,12 @@ POSTGRES_USER="oc_$POSTGRES_USER"
|
||||||
export POSTGRES_USER
|
export POSTGRES_USER
|
||||||
|
|
||||||
# Fix false database connection on old instances
|
# Fix false database connection on old instances
|
||||||
if [ -f "/var/www/html/config/config.php" ] && sleep 2 && psql -d "postgresql://$POSTGRES_USER:$POSTGRES_PASSWORD@$POSTGRES_HOST:5432/$POSTGRES_DB" -c "select now()"; then
|
if [ -f "/var/www/html/config/config.php" ]; then
|
||||||
|
sleep 2
|
||||||
|
while ! psql -d "postgresql://$POSTGRES_USER:$POSTGRES_PASSWORD@$POSTGRES_HOST:5432/$POSTGRES_DB" -c "select now()"; do
|
||||||
|
echo "Waiting for the database to start..."
|
||||||
|
sleep 5
|
||||||
|
done
|
||||||
sed -i "s|'dbuser'.*=>.*$|'dbuser' => '$POSTGRES_USER',|" /var/www/html/config/config.php
|
sed -i "s|'dbuser'.*=>.*$|'dbuser' => '$POSTGRES_USER',|" /var/www/html/config/config.php
|
||||||
sed -i "s|'dbpassword'.*=>.*$|'dbpassword' => '$POSTGRES_PASSWORD',|" /var/www/html/config/config.php
|
sed -i "s|'dbpassword'.*=>.*$|'dbpassword' => '$POSTGRES_PASSWORD',|" /var/www/html/config/config.php
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue