scripts: Rename DEFAULT_USER to POSTGRES_USER.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
This commit is contained in:
Anders Kaseorg
2019-04-12 16:30:49 -07:00
committed by Tim Abbott
parent 8a15b9ee87
commit 53879c4673
2 changed files with 8 additions and 8 deletions

View File

@@ -1,9 +1,9 @@
#!/usr/bin/env bash
set -e
DEFAULT_USER="postgres"
POSTGRES_USER="postgres"
if [ "$(uname)" = "OpenBSD" ]; then
DEFAULT_USER="_postgresql"
POSTGRES_USER="_postgresql"
fi
cd /
@@ -15,7 +15,7 @@ tables="$(printf "'%s'," "${@//\'/\'\'}")"
tables="${tables%,}"
if [ "$EUID" -eq 0 ]; then
su - "$DEFAULT_USER" -c "psql postgres '$DEFAULT_USER'" <<EOF
su - "$POSTGRES_USER" -c "psql postgres '$POSTGRES_USER'" <<EOF
SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE datname IN ($tables);
EOF
else