Rollback some stuff + whitespace fixes

This commit is contained in:
Patrick Van der Veken 2020-04-08 11:49:37 +02:00
parent c8aa4aad79
commit 8b6b2e9c31
2 changed files with 1111 additions and 1106 deletions

View File

@ -30,7 +30,7 @@
# RETURNS: 0
function version_include_core
{
typeset _VERSION="2020-04-07" # YYYY-MM-DD
typeset _VERSION="2020-04-08" # YYYY-MM-DD
print "INFO: $0: ${_VERSION#version_*}"
@ -758,7 +758,8 @@ do
if (( ERROR_COUNT > 0 ))
then
: >${TMP_FILE} 2>/dev/null
awk -F"${LOG_SEP}" -v OFS="${LOG_SEP}" '
# shellcheck disable=SC2002
cat ${FIX_FILE} 2>/dev/null | awk -F"${LOG_SEP}" -v OFS="${LOG_SEP}" '
BEGIN { max_log_fields = '"${NUM_LOG_FIELDS}"'
max_fields = (max_log_fields - 1) * 2
@ -834,7 +835,7 @@ do
# correct log line, no rewrite needed
print $0
}
}' ${FIX_FILE} >${TMP_FILE} 2>/dev/null
}' >${TMP_FILE} 2>/dev/null
# count after rewrite (include empty lines again in the count)
TMP_COUNT=$(wc -l ${TMP_FILE} 2>/dev/null | cut -f1 -d' ' 2>/dev/null)
@ -1529,8 +1530,8 @@ function is_scheduled
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
typeset CRON_HC="${1}"
typeset CRON_COUNT=0
typeset CRON_SYS_LOCATIONS="/etc/crontab /etc/cron.d/*"
typeset CRON_ANACRON_LOCATIONS="/etc/anacrontab /etc/cron.*"
typeset CRON_SYS_LOCATIONS='/etc/crontab /etc/cron.d/*'
typeset CRON_ANACRON_LOCATIONS='/etc/anacrontab /etc/cron.*'
# check for a scheduled job
case "${OS_NAME}" in
@ -1553,6 +1554,7 @@ case "${OS_NAME}" in
*)
# use default root crontab
CRON_COUNT=$(crontab -l 2>/dev/null | grep -c -E -e "^[^#].*${CRON_HC}" 2>/dev/null)
;;
esac
return ${CRON_COUNT}
@ -1703,7 +1705,8 @@ fi
print "${FPATH}" | tr ':' '\n' 2>/dev/null | grep -v "core$" 2>/dev/null | sort 2>/dev/null |\
while read -r FDIR
do
find ${FDIR} -name "${FNEEDLE}" 2>/dev/null | sort 2>/dev/null | while read -r FFILE
# shellcheck disable=SC2012
ls -1 ${FDIR}/${FNEEDLE} 2>/dev/null | sort 2>/dev/null | while read -r FFILE
do
# cache script contents in memory
FSCRIPT=$(<${FFILE})

View File

@ -30,7 +30,7 @@
function report_std
{
# ------------------------- CONFIGURATION starts here -------------------------
typeset _VERSION="2020-04-07" # YYYY-MM-DD
typeset _VERSION="2020-04-08" # YYYY-MM-DD
typeset _SUPPORTED_PLATFORMS="AIX,HP-UX,Linux" # uname -s match
# ------------------------- CONFIGURATION ends here ---------------------------
@ -63,6 +63,7 @@ typeset _HC_REPORT_CACHE_LAST_STUB="${STATE_PERM_DIR}/cache.report-last"
typeset _HC_REPORT_CACHE_LAST_FILE=""
typeset _HC_REPORT_CACHE_TODAY_FILE="${STATE_PERM_DIR}/cache.report-today"
typeset _USE_CACHE=0
typeset _USE_ANY_CACHE=0
typeset _CACHE_NOTE_BIT=""
# set archive log stash (never use cache files)
@ -166,6 +167,7 @@ then
then
_LOG_STASH="${_HC_REPORT_CACHE_LAST_FILE}"
_USE_CACHE=1
_USE_ANY_CACHE=1
(( ARG_DEBUG > 0 )) && debug "setting log stash to cache file at ${_HC_REPORT_CACHE_LAST_FILE}"
else
(( ARG_DEBUG > 0 )) && debug "HC_REPORT_CACHE_LAST is enabled but unable to find cache file at ${_HC_REPORT_CACHE_LAST_FILE}"
@ -233,7 +235,7 @@ then
# spacer
print
# disclaimer & note(s)
if (( _USE_CACHE > 0 ))
if (( _USE_ANY_CACHE > 0 ))
then
print "NOTE: entries suffixed by (C) indicate results were retrieved from a cache file. If you wish to use "
print " the real log files then disable HC_REPORT_CACHE_LAST in ${CONFIG_FILE}"