funcs cleanup, exitError: printf formatting
This commit is contained in:
parent
ffc7579666
commit
e74971997f
@ -74,39 +74,39 @@ cleanup () {
|
|||||||
# cleanup 503 if copied
|
# cleanup 503 if copied
|
||||||
if [ "$err503Copied" -eq 1 ]; then
|
if [ "$err503Copied" -eq 1 ]; then
|
||||||
if ! rm -f "$webroot/$err503File" 2>>"$logFile"; then
|
if ! rm -f "$webroot/$err503File" 2>>"$logFile"; then
|
||||||
printf "${warn}[%s] -- [WARNING] Could not remove 503 error page." \
|
printf "%s[%s] -- [WARNING] Could not remove 503 error page." \
|
||||||
"$(stamp)" >> "$logFile"
|
"$warn" "$(stamp)" >> "$logFile"
|
||||||
printf " Web interface will not function until this file is " \
|
printf " Web interface will not function until this file is " \
|
||||||
>> "$logFile"
|
>> "$logFile"
|
||||||
printf "removed --${norm}\n" >> "$logFile"
|
printf "removed --%s\n" "$norm" >> "$logFile"
|
||||||
warnCount=$((warnCount+1))
|
warnCount=$((warnCount+1))
|
||||||
else
|
else
|
||||||
printf "${cyan}[%s] -- [INFO] 503 error page removed --${norm}\n" \
|
printf "%s[%s] -- [INFO] 503 error page removed --%s\n" \
|
||||||
"$(stamp)" >> "$logFile"
|
"$cyan" "$(stamp)" "$norm" >> "$logFile"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
# remove EML temporary directory
|
# remove EML temporary directory
|
||||||
if ! rm -rf "$exportDir" 2>>"$logFile"; then
|
if ! rm -rf "$exportDir" 2>>"$logFile"; then
|
||||||
printf "${warn}[%s] -- [WARNING] Could not remove EML export tmp dir:" \
|
printf "%s[%s] -- [WARNING] Could not remove EML export tmp dir:" \
|
||||||
"$(stamp)" >> "$logFile"
|
"$warn" "$(stamp)" >> "$logFile"
|
||||||
printf "\n%s\n" "$exportDir" >> "$logFile"
|
printf "\n%s\n" "$exportDir" >> "$logFile"
|
||||||
printf "please remove this directory manually! --${norm}\n" \
|
printf "please remove this directory manually! --%s\n" "$norm" \
|
||||||
>> "$logFile"
|
>> "$logFile"
|
||||||
warnCount=$((warnCount+1))
|
warnCount=$((warnCount+1))
|
||||||
else
|
else
|
||||||
printf "${cyan}[%s] -- [INFO] EML temp directory removed --${norm}\n" \
|
printf "%s[%s] -- [INFO] EML temp directory removed --%s\n" \
|
||||||
"$(stamp)" >> "$logFile"
|
"$cyan" "$(stamp)" "$norm" >> "$logFile"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# call cleanup and then exit with error report
|
# call cleanup and then exit with error report
|
||||||
exitError () {
|
exitError () {
|
||||||
printf "${err}[%s] -- [ERROR] %s: %s --${norm}\n" \
|
printf "%s[%s] -- [ERROR] %s: %s --%s\n" \
|
||||||
"$(stamp)" "$1" "$2" >> "$logFile"
|
"$err" "$(stamp)" "$1" "$2" "$norm" >> "$logFile"
|
||||||
cleanup
|
cleanup
|
||||||
# note script completion with error
|
# note script completion with error
|
||||||
printf "${err}[%s] --- %s execution completed with error ---${norm}\n" \
|
printf "%s[%s] --- %s execution completed with error ---%s\n" \
|
||||||
"$(stamp)" "$scriptName" >> "$logFile"
|
"$err" "$(stamp)" "$scriptName" "$norm" >> "$logFile"
|
||||||
exit "$1"
|
exit "$1"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user