Skip to content

Commit eb5e797

Browse files
committed
Make Oracle Database healthcheck wait for the custom scripts to finish
1 parent 801bdcb commit eb5e797

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

OracleDatabase/SingleInstance/dockerfiles/21.3.0/checkDBStatus.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,11 @@ EOF
7373
################ MAIN #######################
7474
#############################################
7575

76+
if [ "${BYPASS_STARTED_MARKER:-false}" = false ] && [ ! -f /tmp/.oracle_database_started ]; then
77+
echo "Database was not started yet" >&2
78+
exit 1
79+
fi
80+
7681
# Setting up ORACLE_PWD if podman secret is passed on
7782
if [ -e '/run/secrets/oracle_pwd' ]; then
7883
export ORACLE_PWD="$(cat '/run/secrets/oracle_pwd')"

OracleDatabase/SingleInstance/dockerfiles/21.3.0/runOracle.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,9 @@ EOF
113113
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! #
114114
###################################
115115

116+
# Marker file for the healthcheck
117+
rm -f /tmp/.oracle_database_started
118+
116119
# Check whether container has enough memory
117120
if [[ -f /sys/fs/cgroup/cgroup.controllers ]]; then
118121
memory=$(cat /sys/fs/cgroup/memory.max)
@@ -303,7 +306,7 @@ else
303306
fi;
304307

305308
# Check whether database is up and running
306-
"$ORACLE_BASE"/"$CHECK_DB_FILE"
309+
BYPASS_STARTED_MARKER=true "$ORACLE_BASE"/"$CHECK_DB_FILE"
307310
status=$?
308311

309312
# Check whether database is up and running
@@ -317,7 +320,9 @@ if [ $status -eq 0 ]; then
317320

318321
# Execute custom provided startup scripts
319322
"$ORACLE_BASE"/"$USER_SCRIPTS_FILE" "$ORACLE_BASE"/scripts/startup
320-
323+
324+
# Marker file for the healthcheck
325+
touch /tmp/.oracle_database_started
321326
else
322327
echo "#####################################"
323328
echo "########### E R R O R ###############"

0 commit comments

Comments
 (0)