Changed script exit to list all warnings in array variable (code 100)

This commit is contained in:
Asif Bacchus 2018-09-07 02:23:02 -06:00
parent 10f58c4c0a
commit 6ebbb262d5
1 changed files with 8 additions and 6 deletions

View File

@ -142,7 +142,7 @@ function quit {
elif [ "$2" = "warn" ]; then elif [ "$2" = "warn" ]; then
# exit with warning code # exit with warning code
echo -e "\e[1;33m[`date +%Y-%m-%d` `date +%H:%M:%S`]" \ echo -e "\e[1;33m[`date +%Y-%m-%d` `date +%H:%M:%S`]" \
"--Script exiting with WARNING (code: $1)--\e[0m" >> $logFile "--Script exiting with WARNING(S) (code: ${exitWarning[*]})--\e[0m" >> $logFile
exit "$1" exit "$1"
else else
# exit with error code # exit with error code
@ -423,9 +423,11 @@ fi
## Log completion of script ## Log completion of script
echo -e "\e[1;32m[`date +%Y-%m-%d` `date +%H:%M:%S`]" \ if [ ${#exitWarning[@]} -gt 0 ]; then
"--Backup operations completed--\e[0m" >> $logFile quit 100 warn
else
quit
fi
# end of script -- this exit should not be necessary
# Gracefully exit exit 999
exit 0