You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ClinicalTrialsDataProcessing/containers/AACT_downloader/docker-entrypoint-initdb.d/010_load_db_dump.sh

19 lines
540 B
Bash

#!/bin/bash
set -e
set -x
# This file loads the database dump into the postgres database
dump_path="/mnt/host_data/postgres_data.dmp"
#Double check the postgres user and database are set
if [[ -z $POSTGRES_USER && -z $POSTGRES_DB ]]; #if either POSTGRES_USER or POSTGRES_DB are empty, throw an error.
then
echo "Missing either the POSTGRESS_USER or the POSTGRES_DB environment variable"
exit 4
else
#restore the DB
pg_restore -e -v -O -x --dbname="$POSTGRES_DB" --username="$POSTGRES_USER" --no-owner "$dump_path"
fi