Skip to content

Commit

Permalink
geonetwork#20: use a known db for a checking SELECT
Browse files Browse the repository at this point in the history
  • Loading branch information
etj committed Apr 4, 2019
1 parent 9a28f0a commit b0d605a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions 3.6.0/postgres/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ if [ "$1" = 'catalina.sh' ]; then
echo "$db_host:$db_port:*:$POSTGRES_DB_USERNAME:$POSTGRES_DB_PASSWORD" > ~/.pgpass
chmod 0600 ~/.pgpass
for db_name in "$db_admin" "$db_gn"; do
if psql -h "$db_host" -U "$POSTGRES_DB_USERNAME" -p "$db_port" -tqc "SELECT 1 FROM pg_database WHERE datname = '$db_name'" | grep -q 1; then
if psql -h "$db_host" -U "$POSTGRES_DB_USERNAME" -p "$db_port" -tqc "SELECT 1 FROM pg_database WHERE datname = '$db_name'" postgres | grep -q 1; then
echo "database '$db_name' exists; skipping createdb"
else
createdb -h "$db_host" -U "$POSTGRES_DB_USERNAME" -p "$db_port" -O "$POSTGRES_DB_USERNAME" "$db_name"
Expand All @@ -48,4 +48,4 @@ if [ "$1" = 'catalina.sh' ]; then
sed -i -e 's#5432#${jdbc.port}#g' $CATALINA_HOME/webapps/geonetwork/WEB-INF/config-db/postgres.xml
fi

exec "$@"
exec "$@"

0 comments on commit b0d605a

Please sign in to comment.