Import bug fix which obsoletes --fix-logs

This commit is contained in:
Patrick Van der Veken 2019-05-19 09:03:57 +02:00
parent 62095c510e
commit f891b1bfea
3 changed files with 19 additions and 11 deletions

View File

@ -38,7 +38,7 @@
# ------------------------- CONFIGURATION starts here ------------------------- # ------------------------- CONFIGURATION starts here -------------------------
# define the version (YYYY-MM-DD) # define the version (YYYY-MM-DD)
typeset -r SCRIPT_VERSION="2019-05-14" typeset -r SCRIPT_VERSION="2019-05-19"
# location of parent directory containing KSH functions/HC plugins # location of parent directory containing KSH functions/HC plugins
typeset -r FPATH_PARENT="/opt/hc/lib" typeset -r FPATH_PARENT="/opt/hc/lib"
# location of custom HC configuration files # location of custom HC configuration files

View File

@ -30,7 +30,7 @@
# RETURNS: 0 # RETURNS: 0
function version_include_core function version_include_core
{ {
typeset _VERSION="2019-04-03" # YYYY-MM-DD typeset _VERSION="2019-05-19" # YYYY-MM-DD
print "INFO: $0: ${_VERSION#version_*}" print "INFO: $0: ${_VERSION#version_*}"
@ -62,7 +62,7 @@ typeset TMP2_FILE="${TMP_DIR}/.$0.tmp2.archive.$$"
# shellcheck disable=SC2064 # shellcheck disable=SC2064
trap "rm -f ${TMP1_FILE} ${TMP2_FILE} ${SAVE_LOG_FILE} >/dev/null 2>&1; return 1" 1 2 3 15 trap "rm -f ${TMP1_FILE} ${TMP2_FILE} ${SAVE_LOG_FILE} >/dev/null 2>&1; return 1" 1 2 3 15
# get pre-archive log co # get pre-archive log count
PRE_LOG_COUNT=$(wc -l ${HC_LOG} 2>/dev/null | cut -f1 -d' ' 2>/dev/null) PRE_LOG_COUNT=$(wc -l ${HC_LOG} 2>/dev/null | cut -f1 -d' ' 2>/dev/null)
if (( PRE_LOG_COUNT == 0 )) if (( PRE_LOG_COUNT == 0 ))
then then
@ -1129,15 +1129,16 @@ then
ONE_MSG_EXP_VAL=$(data_magic_unquote "${ONE_MSG_EXP_VAL}") ONE_MSG_EXP_VAL=$(data_magic_unquote "${ONE_MSG_EXP_VAL}")
fi fi
fi fi
printf "%s${LOG_SEP}%s${LOG_SEP}%s${LOG_SEP}%s${LOG_SEP}" \ if (( ONE_MSG_STC > 0 ))
then
# do atomic log update
# shellcheck disable=SC1117
printf "%s${LOG_SEP}%s${LOG_SEP}%s${LOG_SEP}%s${LOG_SEP}%s${LOG_SEP}\n" \
"${ONE_MSG_TIME}" \ "${ONE_MSG_TIME}" \
"${HC_NAME}" \ "${HC_NAME}" \
${ONE_MSG_STC} \ ${ONE_MSG_STC} \
"${ONE_MSG_TEXT}" >>${HC_LOG} "${ONE_MSG_TEXT}" \
if (( ONE_MSG_STC > 0 )) "${HC_FAIL_ID}" >>${HC_LOG}
then
# shellcheck disable=SC1117
printf "%s${LOG_SEP}\n" "${HC_FAIL_ID}" >>${HC_LOG}
# RC handling (max/sum/count) # RC handling (max/sum/count)
if (( ARG_FLIP_RC > 0 )) if (( ARG_FLIP_RC > 0 ))
then then
@ -1157,8 +1158,13 @@ then
HC_STC_RC=$(( HC_STC_RC + 1 )) HC_STC_RC=$(( HC_STC_RC + 1 ))
fi fi
else else
# do atomic log update
# shellcheck disable=SC1117 # shellcheck disable=SC1117
printf "\n" >>${HC_LOG} printf "%s${LOG_SEP}%s${LOG_SEP}%s${LOG_SEP}%s${LOG_SEP}\n" \
"${ONE_MSG_TIME}" \
"${HC_NAME}" \
${ONE_MSG_STC} \
"${ONE_MSG_TEXT}" >>${HC_LOG}
fi fi
done done

View File

@ -30,7 +30,7 @@
function report_std function report_std
{ {
# ------------------------- CONFIGURATION starts here ------------------------- # ------------------------- CONFIGURATION starts here -------------------------
typeset _VERSION="2019-03-16" # YYYY-MM-DD typeset _VERSION="2019-05-19" # YYYY-MM-DD
typeset _SUPPORTED_PLATFORMS="AIX,HP-UX,Linux" # uname -s match typeset _SUPPORTED_PLATFORMS="AIX,HP-UX,Linux" # uname -s match
# ------------------------- CONFIGURATION ends here --------------------------- # ------------------------- CONFIGURATION ends here ---------------------------
@ -327,6 +327,8 @@ else
fi fi
# check consistency of log(s) # check consistency of log(s)
# note: should no longer be necessary as of release 19/05/2019 but we keep the
# check alive for now
# shellcheck disable=SC2086 # shellcheck disable=SC2086
find ${_LOG_STASH} -type f -print 2>/dev/null | while read -r _CHECK_FILE find ${_LOG_STASH} -type f -print 2>/dev/null | while read -r _CHECK_FILE
do do