Skip to content

Commit bb837de

Browse files
vfauthVictor Fauth
andauthored
Use existing database if present (#501)
Co-authored-by: Victor Fauth <victor.fauth@thalesgroup.com>
1 parent d92cfd8 commit bb837de

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

docker/startup.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,11 @@
1818
# under the License.
1919
#
2020

21-
/usr/lib/postgresql/13/bin/initdb -D /data/postgresql
22-
/usr/lib/postgresql/13/bin/pg_ctl -D /data/postgresql start
21+
# Start Postgres
22+
/usr/lib/postgresql/13/bin/pg_ctl -D /data/postgresql start || \
23+
# If it fails, maybe the database is not intialized yet, so do it
24+
(/usr/lib/postgresql/13/bin/initdb -D /data/postgresql && \
25+
# Then try to start Postgres again
26+
/usr/lib/postgresql/13/bin/pg_ctl -D /data/postgresql start)
2327
createdb
2428
psql -f /pulsar-manager/init_db.sql
25-

0 commit comments

Comments
 (0)