|
|
@ -52,7 +52,7 @@ function checkVersion() { |
|
|
|
#------------------------------------------------------------------------------- |
|
|
|
function die() { |
|
|
|
local STATUS=${2:-1} |
|
|
|
notify "${1}" ${STATUS} |
|
|
|
notify ${STATUS} "${1}" |
|
|
|
printError "${1}" |
|
|
|
echo -ne "\n" |
|
|
|
exit ${STATUS} |
|
|
@ -169,12 +169,12 @@ function logOutput() { |
|
|
|
|
|
|
|
#------------------------------------------------------------------------------- |
|
|
|
# Sends an e-mail notification about occured error |
|
|
|
# Parameters: %message% %code% |
|
|
|
# Parameters: %status% %message% |
|
|
|
#------------------------------------------------------------------------------- |
|
|
|
function notify() { |
|
|
|
if isEnabled ${LOGGING} && isSet NOTIFY && isEnabled ${EZNOTIFY}; then |
|
|
|
local LOGS="Full output from logs:\n\n$(cat ${LOGFILE})" |
|
|
|
local MESG="The ${EZNAME} has failed with code: ${2} and message: ${1}" |
|
|
|
local MESG="The ${EZNAME} has failed with code: ${1} and message: ${2}" |
|
|
|
local TOPIC="The ${EZNAME} process has failed!" |
|
|
|
echo -e "${MESG}\n${LOGS}" | mailx -s "${TOPIC}" "${NOTIFY}" |
|
|
|
fi |
|
|
|