From e3835554a7070c88a20bf86d14584a10b98042ef Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Thu, 2 Jul 2020 14:00:35 -0700 Subject: [PATCH] postgres-init-db: Read terminate-psql-sessions script as root. Fixes #15646. Signed-off-by: Anders Kaseorg --- scripts/setup/postgres-init-db | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/setup/postgres-init-db b/scripts/setup/postgres-init-db index 016349a50a..96c3f29539 100755 --- a/scripts/setup/postgres-init-db +++ b/scripts/setup/postgres-init-db @@ -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