mirror of https://github.com/zulip/zulip.git
terminate-psql-sessions: Allow running without sudo.
This commit is contained in:
parent
042893a448
commit
327b70cb19
|
@ -15,7 +15,7 @@ tables="$(printf "'%s'," "${@//\'/\'\'}")"
|
||||||
tables="${tables%,}"
|
tables="${tables%,}"
|
||||||
|
|
||||||
if [ "$EUID" -eq 0 ]; then
|
if [ "$EUID" -eq 0 ]; then
|
||||||
sudo -u "$DEFAULT_USER" psql postgres "$DEFAULT_USER" <<EOF
|
su - "$DEFAULT_USER" -c "psql postgres '$DEFAULT_USER'" <<EOF
|
||||||
SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE datname IN ($tables);
|
SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE datname IN ($tables);
|
||||||
EOF
|
EOF
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue