implement die()
This commit is contained in:
parent
4e982538d7
commit
bd1ee52278
|
@ -3,6 +3,21 @@
|
||||||
# Distributed under the terms of the GNU General Public License v3
|
# Distributed under the terms of the GNU General Public License v3
|
||||||
|
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
# Outputs formatted error message and aborts script execution with given code
|
||||||
|
# Parameters: %message% %code%
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
function die() {
|
||||||
|
if isEnabled ${LOGGING} && isSet NOTIFY; then
|
||||||
|
local LOGS="Full output from logs:\n\n$(cat ${LOGFILE})"
|
||||||
|
local MESG="The ${EZNAME} has failed with code: ${2} and message: ${1}"
|
||||||
|
local TOPIC="The ${EZNAME} process has failed!"
|
||||||
|
echo -e "${MESG}\n${LOGS}" | mailx -s "${TOPIC}" "${NOTIFY}"
|
||||||
|
fi
|
||||||
|
printError "${1}"
|
||||||
|
exit ${2}
|
||||||
|
}
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
# Checks whether a supplied variable is defined or not
|
# Checks whether a supplied variable is defined or not
|
||||||
# Parameters: %variable%
|
# Parameters: %variable%
|
||||||
|
|
Loading…
Reference in New Issue