diff --git a/scripts/setup/postgres-init-db b/scripts/setup/postgres-init-db index 1b909a8074..5e0d3ba8be 100755 --- a/scripts/setup/postgres-init-db +++ b/scripts/setup/postgres-init-db @@ -2,9 +2,6 @@ set -e set -x -# Make sure the current working directory is readable -cd / - # Shut down all services to ensure a quiescent state. supervisorctl stop all @@ -12,6 +9,10 @@ supervisorctl stop all # source because postgres user can't read /root/zulip/scripts/setup. source "$(dirname "$0")/terminate-psql-sessions" postgres zulip zulip_base +( +# Make sure the current working directory is readable by postgres +cd / + su postgres -c psql <