Skip to content

Commit 84f8b14

Browse files
sbalousekDjelibeybi
authored andcommitted
Oracle GoldenGate
- Clean up script execution logic Signed-off-by: Stephen Balousek <[email protected]>
1 parent 6c64202 commit 84f8b14

File tree

1 file changed

+15
-41
lines changed

1 file changed

+15
-41
lines changed

OracleGoldenGate/23/bin/deployment-main.sh

Lines changed: 15 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -126,48 +126,22 @@ function setup_deployment_directories() {
126126

127127
##
128128
## r u n _ u s e r _ s c r i p t s
129-
##
130-
## Hook for launching custom scripts in the container before and after ogg start
131-
## Default Values:
132-
## - ${OGG_DEPLOYMENT_SCRIPTS} : "${OGG_HOME}/scripts"
133-
##
134-
## Scripts are run lexicographically and recursively from the directories pointed to by:
135-
## - ${OGG_DEPLOYMENT_SCRIPTS}/setup are executed prior to any other steps in the boot sequence
136-
## - ${OGG_DEPLOYMENT_SCRIPTS}/startup are executed after ogg/nginx startup
129+
## Run custom scripts in the container before and after GoldenGate starts
137130
##
138131
function run_user_scripts {
139-
140-
local SCRIPTS_ROOT="${1}";
141-
142-
[ -z "$SCRIPTS_ROOT" ] && {
143-
printf "%s: No SCRIPTS_ROOT passed on, no scripts will be run\n" "${0}";
144-
return 1;
145-
} || {
146-
if [ -d "$SCRIPTS_ROOT" ] && [ -n "$(ls -A "$SCRIPTS_ROOT")" ]; then
147-
printf "Executing user defined scripts in: %s\n" "${SCRIPTS_ROOT}"
148-
149-
for f in "${SCRIPTS_ROOT}"/*; do
150-
[ -d "${f}" ] && {
151-
run_user_scripts "${f}"
152-
} || {
153-
case "$f" in
154-
*.sh)
155-
printf "%s: running %s\n" "${0}" "${f}";
156-
source "$f" && state=$? || state=$?
157-
;;
158-
*)
159-
printf "%s: ignoring %s\n" "${0}" "${f}" && state=$? || state=$?
160-
;;
161-
esac
162-
echo "";
163-
}
164-
done
165-
echo "DONE: Executing user defined scripts"
166-
echo "";
167-
fi
168-
}
169-
170-
return 0
132+
local scripts="${1}";
133+
while read -r script; do
134+
case "${script}" in
135+
*.sh)
136+
echo "Running script '${script}'"
137+
# shellcheck disable=SC1090
138+
source "${script}"
139+
;;
140+
*)
141+
echo "Ignoring '${script}'"
142+
;;
143+
esac
144+
done < <(find "${scripts}" -type f | sort)
171145
}
172146

173147
##
@@ -218,8 +192,8 @@ function signal_handling() {
218192
##
219193
## Entrypoint
220194
##
221-
run_user_scripts "${OGG_DEPLOYMENT_SCRIPTS}/setup"
222195
generatePassword
196+
run_user_scripts "${OGG_DEPLOYMENT_SCRIPTS}/setup"
223197
setup_deployment_directories
224198
locate_java
225199
locate_lib_jvm

0 commit comments

Comments
 (0)