postgres-init-db: Read terminate-psql-sessions script as root.

Fixes #15646.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2020-07-02 14:00:35 -07:00 committed by Anders Kaseorg
parent 3a973b15ee
commit e3835554a7
1 changed files with 2 additions and 1 deletions

View File

@ -33,8 +33,9 @@ if [ -e "/var/run/supervisor.sock" ]; then
fi
# Drop any open connections to any old database.
# Send the script via stdin in case the postgres user lacks permission to read it.
su -s /usr/bin/env - -- "$POSTGRES_USER" \
"$(dirname "$0")/terminate-psql-sessions" zulip zulip_base
bash -s - zulip zulip_base < "$(dirname "$0")/terminate-psql-sessions"
(
cd / # Make sure the current working directory is readable by postgres