28 lines
441 B
Bash
28 lines
441 B
Bash
|
#!/bin/bash
|
||
|
echo Migrate PostgreSQL version
|
||
|
|
||
|
DB_PATH=/db
|
||
|
OLD_DB_PATH=/tmp/old_db
|
||
|
|
||
|
# Run database on a COPY of the database
|
||
|
cp -r "$DB_PATH" "$OLD_DB_PATH"
|
||
|
|
||
|
# Start the database in the background
|
||
|
/postgres/16/bin/postgres -D /tmp/old_db/ &
|
||
|
|
||
|
while true;
|
||
|
do
|
||
|
echo Waiting for database...
|
||
|
if echo "\q" | /postgres/16/bin/psql -U "$POSTGRES_USER";
|
||
|
then
|
||
|
break
|
||
|
fi
|
||
|
done
|
||
|
|
||
|
# Perform dump
|
||
|
|
||
|
|
||
|
# Stop database
|
||
|
#pkill postgres
|
||
|
|
||
|
bash
|