Skip to content

Commit 04531b4

Browse files
author
Ruben L. Mendoza
authored
Merge pull request #244 from developmentseed/restore_backup_db
Check if database is up before restoring
2 parents ac55187 + 0bb04a2 commit 04531b4

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

images/backup-restore/start.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,12 @@ fi
5454
# Restoring DataBase
5555
if [ "$DB_ACTION" == "restore" ]; then
5656
# AWS
57+
flag=true
58+
while "$flag" = true; do
59+
pg_isready -h $POSTGRES_HOST -p 5432 >/dev/null 2>&2 || continue
60+
flag=false
5761
wget -O $restoreFile $RESTORE_URL_FILE
5862
gunzip <$restoreFile | psql -h $POSTGRES_HOST -U $POSTGRES_USER -d $POSTGRES_DB
5963
echo " Import data to $POSTGRES_DB has finished ..."
64+
done
6065
fi

0 commit comments

Comments
 (0)