summaryrefslogtreecommitdiff
path: root/scripts/create_postgres_user.sh
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/create_postgres_user.sh')
-rw-r--r--scripts/create_postgres_user.sh8
1 files changed, 5 insertions, 3 deletions
diff --git a/scripts/create_postgres_user.sh b/scripts/create_postgres_user.sh
index 0fa065b0387..8e0f84f62ca 100644
--- a/scripts/create_postgres_user.sh
+++ b/scripts/create_postgres_user.sh
@@ -1,6 +1,8 @@
#!/bin/bash
-psql -h localhost -U postgres postgres <<EOF
-CREATE USER gitlab;
-GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO gitlab;
+if pg_isready -h localhost -U postgres; then
+ psql -h localhost -U postgres postgres <<EOF
+ CREATE USER gitlab;
+ GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO gitlab;
EOF
+fi