You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by ti...@apache.org on 2023/03/20 11:34:20 UTC
[pulsar-manager] branch master updated: Use existing database if present (#501)
This is an automated email from the ASF dual-hosted git repository.
tison pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar-manager.git
The following commit(s) were added to refs/heads/master by this push:
new bb837de Use existing database if present (#501)
bb837de is described below
commit bb837debbecfbe013f4243bd18a054ce3c10f831
Author: Victor Fauth <vi...@fauth.eu>
AuthorDate: Mon Mar 20 12:34:12 2023 +0100
Use existing database if present (#501)
Co-authored-by: Victor Fauth <vi...@thalesgroup.com>
---
docker/startup.sh | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/docker/startup.sh b/docker/startup.sh
index 11c24fc..80152f9 100755
--- a/docker/startup.sh
+++ b/docker/startup.sh
@@ -18,8 +18,11 @@
# under the License.
#
-/usr/lib/postgresql/13/bin/initdb -D /data/postgresql
-/usr/lib/postgresql/13/bin/pg_ctl -D /data/postgresql start
+# Start Postgres
+/usr/lib/postgresql/13/bin/pg_ctl -D /data/postgresql start || \
+ # If it fails, maybe the database is not intialized yet, so do it
+ (/usr/lib/postgresql/13/bin/initdb -D /data/postgresql && \
+ # Then try to start Postgres again
+ /usr/lib/postgresql/13/bin/pg_ctl -D /data/postgresql start)
createdb
psql -f /pulsar-manager/init_db.sql
-