Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

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

Anders Kaseorge3835554a707
diff --git a/scripts/setup/postgres-init-db b/scripts/setup/postgres-init-db
index 016349a50a3..96c3f295395 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