Skip to content

Commit

Permalink
Use PGDATA rather than hard coded default path
Browse files Browse the repository at this point in the history
  • Loading branch information
justinclift committed Sep 30, 2024
1 parent ff148c4 commit e9f1be5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -579,15 +579,15 @@ _main() {
echo "------------------------"

# Get the list of databases in the database cluster
DB_LIST=$(echo 'SELECT datname FROM pg_catalog.pg_database WHERE datistemplate IS FALSE' | postgres --single -D /var/lib/postgresql/data 2>/dev/null | grep datname | grep -v backend | cut -d '"' -f 2)
DB_LIST=$(echo 'SELECT datname FROM pg_catalog.pg_database WHERE datistemplate IS FALSE' | postgres --single -D "${PGDATA}" 2>/dev/null | grep datname | grep -v backend | cut -d '"' -f 2)

# For each database, reindex it
for DATABASE in ${DB_LIST}; do
echo "-------------------------------"
echo "Starting reindex of ${DATABASE}"
echo "-------------------------------"

echo 'REINDEX DATABASE' | postgres --single -D /var/lib/postgresql/data "${DATABASE}"
echo 'REINDEX DATABASE' | postgres --single -D "${PGDATA}" "${DATABASE}"

echo "-------------------------------"
echo "Finished reindex of ${DATABASE}"
Expand Down

0 comments on commit e9f1be5

Please sign in to comment.