fix(cleanup): prevent doDocker error loop
- if doDocker throws an error, cleanup is called which again calls doDocker - resolve this loop by passing a variable from cleanup
This commit is contained in:
parent
bd36035a9f
commit
5382dd26d9
@ -98,14 +98,14 @@ cleanup() {
|
|||||||
printf "%s[%s] -- [INFO] POSTFIX container is running --%s\n" \
|
printf "%s[%s] -- [INFO] POSTFIX container is running --%s\n" \
|
||||||
"$cyan" "$(stamp)" "$norm" >>"$logFile"
|
"$cyan" "$(stamp)" "$norm" >>"$logFile"
|
||||||
else
|
else
|
||||||
exitError 102 'Could not start POSTFIX container.'
|
exitError 102 'Could not start POSTFIX container.' 'final'
|
||||||
fi
|
fi
|
||||||
doDocker start dovecot
|
doDocker start dovecot
|
||||||
if [ "$dockerResultState" = "true" ]; then
|
if [ "$dockerResultState" = "true" ]; then
|
||||||
printf "%s[%s] -- [INFO] DOVECOT container is running --%s\n" \
|
printf "%s[%s] -- [INFO] DOVECOT container is running --%s\n" \
|
||||||
"$cyan" "$(stamp)" "$norm" >>"$logFile"
|
"$cyan" "$(stamp)" "$norm" >>"$logFile"
|
||||||
else
|
else
|
||||||
exitError 102 'Could not start DOVECOT container.'
|
exitError 102 'Could not start DOVECOT container.' 'final'
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -133,7 +133,7 @@ doDocker() {
|
|||||||
exitError() {
|
exitError() {
|
||||||
printf "%s[%s] -- [ERROR] %s: %s --%s\n" \
|
printf "%s[%s] -- [ERROR] %s: %s --%s\n" \
|
||||||
"$err" "$(stamp)" "$1" "$2" "$norm" >>"$logFile"
|
"$err" "$(stamp)" "$1" "$2" "$norm" >>"$logFile"
|
||||||
cleanup
|
if [ ! "$3" = "final" ]; then cleanup; fi
|
||||||
# note script completion with error
|
# note script completion with error
|
||||||
printf "%s[%s] --- %s execution completed with error ---%s\n" \
|
printf "%s[%s] --- %s execution completed with error ---%s\n" \
|
||||||
"$err" "$(stamp)" "$scriptName" "$norm" >>"$logFile"
|
"$err" "$(stamp)" "$scriptName" "$norm" >>"$logFile"
|
||||||
|
Loading…
Reference in New Issue
Block a user