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" \
|
||||
"$cyan" "$(stamp)" "$norm" >>"$logFile"
|
||||
else
|
||||
exitError 102 'Could not start POSTFIX container.'
|
||||
exitError 102 'Could not start POSTFIX container.' 'final'
|
||||
fi
|
||||
doDocker start dovecot
|
||||
if [ "$dockerResultState" = "true" ]; then
|
||||
printf "%s[%s] -- [INFO] DOVECOT container is running --%s\n" \
|
||||
"$cyan" "$(stamp)" "$norm" >>"$logFile"
|
||||
else
|
||||
exitError 102 'Could not start DOVECOT container.'
|
||||
exitError 102 'Could not start DOVECOT container.' 'final'
|
||||
fi
|
||||
}
|
||||
|
||||
@ -133,7 +133,7 @@ doDocker() {
|
||||
exitError() {
|
||||
printf "%s[%s] -- [ERROR] %s: %s --%s\n" \
|
||||
"$err" "$(stamp)" "$1" "$2" "$norm" >>"$logFile"
|
||||
cleanup
|
||||
if [ ! "$3" = "final" ]; then cleanup; fi
|
||||
# note script completion with error
|
||||
printf "%s[%s] --- %s execution completed with error ---%s\n" \
|
||||
"$err" "$(stamp)" "$scriptName" "$norm" >>"$logFile"
|
||||
|
Loading…
Reference in New Issue
Block a user