From 878cbe6d0e799d3e5098aa80f67d7daba651015f Mon Sep 17 00:00:00 2001 From: Daniel Bahrdt Date: Wed, 19 Feb 2020 01:26:14 +0100 Subject: [PATCH] Initialize postgres cluster if the cluster storage directory is empty --- run.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/run.sh b/run.sh index ab7d659..67f99e9 100755 --- a/run.sh +++ b/run.sh @@ -26,6 +26,10 @@ fi if [ "$1" = "import" ]; then # Initialize PostgreSQL createPostgresConfig + if [ ! -f /var/lib/postgresql/12/main/PG_VERSION ]; then + echo "Initializing postgres cluster" + sudo -u postgres /usr/lib/postgresql/12/bin/pg_ctl -D /var/lib/postgresql/12/main/ initdb -o "--locale C.UTF-8" || exit 1 + fi service postgresql start sudo -u postgres createuser renderer sudo -u postgres createdb -E UTF8 -O renderer gis