Code cleanup

This commit is contained in:
patvdv 2018-11-04 19:57:20 +01:00
parent 0e6469e477
commit ba8f336945
78 changed files with 395 additions and 393 deletions

View File

@ -58,7 +58,7 @@ typeset -r SCRIPT_DIR=$(dirname "$0")
typeset -r HOST_NAME="$(hostname)"
typeset -r OS_NAME="$(uname -s)"
typeset -r LOCK_DIR="${TMP_DIR}/.${SCRIPT_NAME}.lock"
typeset -r HC_MSG_FILE="${TMP_DIR}/.${SCRIPT_NAME}.hc.msg.$$" # plugin messages files
typeset -r HC_MSG_FILE="${TMP_DIR}/.${SCRIPT_NAME}.hc.msg.$$" # plugin messages file
# shellcheck disable=SC2034
typeset -r LOG_SEP="|" # single character only
# shellcheck disable=SC2034
@ -155,7 +155,7 @@ set +o bgnice
# REQUIRES: n/a
function build_fpath
{
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
typeset FPATH_DIR=""
# do not use a while-do loop here because mksh/pdksh does not pass updated
@ -181,7 +181,7 @@ return 0
# REQUIRES: n/a
function check_config
{
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
# EXEC_USER
if [[ -z "${EXEC_USER}" ]]
@ -224,7 +224,7 @@ return 0
# REQUIRES: n/a
function check_core
{
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
# check and include core helper libs
if [[ -r ${FPATH_PARENT}/core/include_core.sh && -h ${FPATH_PARENT}/core/include_core ]]
@ -290,8 +290,8 @@ return 0
# REQUIRES: n/a
function check_lock_dir
{
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
if (( ARG_LOCK != 0 ))
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
if (( ARG_LOCK > 0 ))
then
mkdir ${LOCK_DIR} >/dev/null || {
print -u2 "ERROR: unable to acquire lock ${LOCK_DIR}"
@ -306,7 +306,7 @@ then
}
print $$ >${LOCK_DIR}/.pid
else
(( ARG_DEBUG != 0 )) && print "DEBUG: locking has been disabled"
(( ARG_DEBUG > 0 )) && print "DEBUG: locking has been disabled"
fi
return 0
@ -320,7 +320,7 @@ return 0
# REQUIRES: n/a
function check_params
{
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
# --debug-level
if (( ARG_DEBUG_LEVEL > 2 ))
@ -345,7 +345,7 @@ then
fi
fi
# --flip-rc
if (( ARG_FLIP_RC != 0 ))
if (( ARG_FLIP_RC > 0 ))
then
# do not allow flip RC for multiple checks
if [[ "${ARG_HC}" = *,* ]] # use =, ksh88
@ -435,7 +435,7 @@ then
exit 1
fi
# check log location
if (( ARG_LOG != 0 ))
if (( ARG_LOG > 0 ))
then
if [[ ! -d "${LOG_DIR}" ]] || [[ ! -w "${LOG_DIR}" ]]
then
@ -455,13 +455,13 @@ return 0
# REQUIRES: $OS_NAME
function check_platform
{
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
typeset HC_PLATFORM="${1}"
typeset RC=0
if [[ "${OS_NAME}" != @(${HC_PLATFORM}) ]]
then
(( ARG_DEBUG != 0 )) && warn "platform ${HC_PLATFORM} does not match ${OS_NAME}"
(( ARG_DEBUG > 0 )) && warn "platform ${HC_PLATFORM} does not match ${OS_NAME}"
RC=1
fi
@ -476,7 +476,7 @@ return ${RC}
# REQUIRES: n/a
function check_user
{
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
typeset WHOAMI=""
# avoid sub-shell for mksh/pdksh
@ -501,15 +501,15 @@ function check_shell
{
case "${KSH_VERSION}" in
*MIRBSD*|*PD*|*LEGACY*)
(( ARG_DEBUG != 0 )) && debug "running ksh: ${KSH_VERSION}"
(( ARG_DEBUG > 0 )) && debug "running ksh: ${KSH_VERSION}"
;;
*)
if [[ -z "${ERRNO}" ]]
then
# shellcheck disable=SC2154
(( ARG_DEBUG != 0 )) && print "running ksh: ${.sh.version}"
(( ARG_DEBUG > 0 )) && print "running ksh: ${.sh.version}"
else
(( ARG_DEBUG != 0 )) && print "running ksh: ksh88 or older"
(( ARG_DEBUG > 0 )) && print "running ksh: ksh88 or older"
fi
;;
esac
@ -607,7 +607,7 @@ return 0
# REQUIRES: log()
function do_cleanup
{
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
log "performing cleanup ..."
# remove temporary files
@ -637,7 +637,7 @@ return 0
# REQUIRES: n/a
function fix_symlinks
{
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
typeset FDIR=""
typeset FFILE=""
typeset FSYML=""
@ -686,7 +686,7 @@ return 0
# REQUIRES: die()
function read_config
{
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
if [[ -z "${CONFIG_FILE}" ]] || [[ -z "${CONFIG_FILE}" ]]
then
@ -1052,7 +1052,7 @@ check_user
trap 'do_cleanup; exit 1' HUP INT QUIT TERM
# set debugging options
if (( ARG_DEBUG != 0 ))
if (( ARG_DEBUG > 0 ))
then
case ${ARG_DEBUG_LEVEL} in
0)
@ -1068,10 +1068,11 @@ then
DEBUG_OPTS='-vx'
;;
esac
set "${DEBUG_OPTS}"
fi
log "*** start of ${SCRIPT_NAME} [${CMD_LINE}] ***"
(( ARG_LOG != 0 )) && log "logging takes places in ${LOG_FILE}"
(( ARG_LOG > 0 )) && log "logging takes places in ${LOG_FILE}"
# check/create lock file & write PID file (only for --run/--archive/--fix-logs)
(( ARG_ACTION == 4 || ARG_ACTION == 11 || ARG_ACTION == 12 )) && check_lock_dir
@ -1154,6 +1155,7 @@ case ${ARG_ACTION} in
print "${ARG_HC}" | tr ',' '\n' | grep -v '^$' | while read -r HC_RUN
do
# re-initialize messages stash (log of failed checks)
# shellcheck disable=SC2034
HC_MSG_VAR=""
: >${HC_MSG_FILE} 2>/dev/null
if (( $? > 0 ))
@ -1261,7 +1263,7 @@ case ${ARG_ACTION} in
EXIT_CODE=${RUN_RC}
kill -s TERM ${SLEEP_PID} >/dev/null 2>&1
# process return codes
if (( RUN_RC != 0 ))
if (( RUN_RC > 0 ))
then
# call for display_init with extra code 'ERROR'
if (( DO_DISPLAY_INIT == 1 ))

View File

@ -36,7 +36,7 @@ typeset _DISPLAY_SEP=";"
# ------------------------- CONFIGURATION ends here ---------------------------
# set defaults
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _DISPLAY_HC="$1"

View File

@ -36,7 +36,7 @@ typeset _SUPPORTED_PLATFORMS="AIX,HP-UX,Linux" # uname -s match
# ------------------------- CONFIGURATION ends here ---------------------------
# set defaults
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _DISPLAY_HC="$1"

View File

@ -35,7 +35,7 @@ typeset _SUPPORTED_PLATFORMS="AIX,HP-UX,Linux" # uname -s match
# ------------------------- CONFIGURATION ends here ---------------------------
# set defaults
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _DISPLAY_HC="$1"

View File

@ -35,7 +35,7 @@ typeset _SUPPORTED_PLATFORMS="AIX,HP-UX,Linux" # uname -s match
# ------------------------- CONFIGURATION ends here ---------------------------
# set defaults
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _DISPLAY_HC="$1"

View File

@ -37,7 +37,7 @@ typeset _SUPPORTED_PLATFORMS="AIX,HP-UX,Linux" # uname -s match
# ------------------------- CONFIGURATION ends here ---------------------------
# set defaults
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _DISPLAY_HC="$1"

View File

@ -31,7 +31,7 @@
# REQUIRES: ${HC_LOG}
function archive_hc
{
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
typeset HC_NAME="${1}"
typeset ARCHIVE_FILE=""
typeset ARCHIVE_RC=0
@ -108,7 +108,7 @@ return ${ARCHIVE_RC}
# REQUIRES: n/a
function count_log_errors
{
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
typeset LOG_STASH="${1}"
typeset ERROR_COUNT=0
@ -152,13 +152,13 @@ return 0
# REQUIRES: n/a
function die
{
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
typeset NOW="$(date '+%d-%h-%Y %H:%M:%S')"
typeset LOG_LINE=""
if [[ -n "${1}" ]]
then
if (( ARG_LOG != 0 ))
if (( ARG_LOG > 0 ))
then
print - "$*" | while read -r LOG_LINE
do
@ -186,7 +186,7 @@ exit 1
# REQUIRES: die()
function discover_core
{
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
typeset NOTIFY_OPTS=""
# init global flags for core plugins (no typeset!)
@ -236,75 +236,75 @@ do
case "${FFILE}" in
*display_csv.sh)
HAS_DISPLAY_CSV=1
(( ARG_DEBUG != 0 )) && debug "display_csv plugin is available"
(( ARG_DEBUG > 0 )) && debug "display_csv plugin is available"
;;
*display_init.sh)
HAS_DISPLAY_INIT=1
(( ARG_DEBUG != 0 )) && debug "display_init plugin is available"
(( ARG_DEBUG > 0 )) && debug "display_init plugin is available"
;;
*display_json.sh)
HAS_DISPLAY_JSON=1
(( ARG_DEBUG != 0 )) && debug "display_json plugin is available"
(( ARG_DEBUG > 0 )) && debug "display_json plugin is available"
;;
*display_terse.sh)
HAS_DISPLAY_TERSE=1
(( ARG_DEBUG != 0 )) && debug "display_terse plugin is available"
(( ARG_DEBUG > 0 )) && debug "display_terse plugin is available"
;;
*display_zenoss.sh)
HAS_DISPLAY_ZENOSS=1
(( ARG_DEBUG != 0 )) && debug "display_zenoss plugin is available"
(( ARG_DEBUG > 0 )) && debug "display_zenoss plugin is available"
;;
*display_custom1.sh)
HAS_DISPLAY_CUSTOM1=1
(( ARG_DEBUG != 0 )) && debug "display_custom1 plugin is available"
(( ARG_DEBUG > 0 )) && debug "display_custom1 plugin is available"
;;
*display_custom2.sh)
HAS_DISPLAY_CUSTOM2=1
(( ARG_DEBUG != 0 )) && debug "display_custom2 plugin is available"
(( ARG_DEBUG > 0 )) && debug "display_custom2 plugin is available"
;;
*display_custom3.sh)
HAS_DISPLAY_CUSTOM3=1
(( ARG_DEBUG != 0 )) && debug "display_custom3 plugin is available"
(( ARG_DEBUG > 0 )) && debug "display_custom3 plugin is available"
;;
*display_custom4.sh)
HAS_DISPLAY_CUSTOM4=1
(( ARG_DEBUG != 0 )) && debug "display_custom4 plugin is available"
(( ARG_DEBUG > 0 )) && debug "display_custom4 plugin is available"
;;
*display_custom5.sh)
HAS_DISPLAY_CUSTOM5=1
(( ARG_DEBUG != 0 )) && debug "display_custom5 plugin is available"
(( ARG_DEBUG > 0 )) && debug "display_custom5 plugin is available"
;;
*display_custom6.sh)
HAS_DISPLAY_CUSTOM6=1
(( ARG_DEBUG != 0 )) && debug "display_custom6 plugin is available"
(( ARG_DEBUG > 0 )) && debug "display_custom6 plugin is available"
;;
*display_custom7.sh)
HAS_DISPLAY_CUSTOM7=1
(( ARG_DEBUG != 0 )) && debug "display_custom7 plugin is available"
(( ARG_DEBUG > 0 )) && debug "display_custom7 plugin is available"
;;
*display_custom8.sh)
HAS_DISPLAY_CUSTOM8=1
(( ARG_DEBUG != 0 )) && debug "display_custom8 plugin is available"
(( ARG_DEBUG > 0 )) && debug "display_custom8 plugin is available"
;;
*display_custom9.sh)
HAS_DISPLAY_CUSTOM9=1
(( ARG_DEBUG != 0 )) && debug "display_custom9 plugin is available"
(( ARG_DEBUG > 0 )) && debug "display_custom9 plugin is available"
;;
*notify_mail.sh)
HAS_NOTIFY_MAIL=1
(( ARG_DEBUG != 0 )) && debug "notify_mail plugin is available"
(( ARG_DEBUG > 0 )) && debug "notify_mail plugin is available"
;;
*notify_sms.sh)
HAS_NOTIFY_SMS=1
(( ARG_DEBUG != 0 )) && debug "notify_sms plugin is available"
(( ARG_DEBUG > 0 )) && debug "notify_sms plugin is available"
;;
*notify_eif.sh)
HAS_NOTIFY_EIF=1
(( ARG_DEBUG != 0 )) && debug "notify_eif plugin is available"
(( ARG_DEBUG > 0 )) && debug "notify_eif plugin is available"
;;
*report_std.sh)
HAS_REPORT_STD=1
(( ARG_DEBUG != 0 )) && debug "report_std plugin is available"
(( ARG_DEBUG > 0 )) && debug "report_std plugin is available"
;;
esac
done
@ -489,7 +489,7 @@ if [[ -n "${ARG_MAIL_TO}" ]] && (( DO_NOTIFY_MAIL == 0 ))
then
die "you cannot specify '--mail-to' without '--notify=mail'"
fi
if (( DO_NOTIFY_MAIL != 0 )) && [[ -z "${ARG_MAIL_TO}" ]]
if (( DO_NOTIFY_MAIL > 0 )) && [[ -z "${ARG_MAIL_TO}" ]]
then
die "you cannot specify '--notify=mail' without '--mail-to'"
fi
@ -502,64 +502,64 @@ if [[ -n "${ARG_SMS_PROVIDER}" ]] && (( DO_NOTIFY_SMS == 0 ))
then
die "you cannot specify '--sms-provider' without '--notify=sms'"
fi
if (( DO_NOTIFY_SMS != 0 )) && [[ -z "${ARG_SMS_TO}" ]]
if (( DO_NOTIFY_SMS > 0 )) && [[ -z "${ARG_SMS_TO}" ]]
then
die "you cannot specify '--notify=sms' without '--sms-to'"
fi
if (( DO_NOTIFY_SMS != 0 )) && [[ -z "${ARG_SMS_PROVIDER}" ]]
if (( DO_NOTIFY_SMS > 0 )) && [[ -z "${ARG_SMS_PROVIDER}" ]]
then
die "you cannot specify '--notify=sms' without '--sms-provider'"
fi
# --report/--detail/--id/--reverse/--last/--today/--with-history
if (( DO_REPORT_STD != 0 ))
if (( DO_REPORT_STD > 0 ))
then
if (( ARG_DETAIL != 0 )) && [[ -z "${ARG_FAIL_ID}" ]]
if (( ARG_DETAIL > 0 )) && [[ -z "${ARG_FAIL_ID}" ]]
then
die "you must specify an unique value for '--id' when using '--detail'"
fi
if (( ARG_LAST != 0 )) && (( ARG_TODAY != 0 ))
if (( ARG_LAST > 0 )) && (( ARG_TODAY > 0 ))
then
die "you cannot specify '--last' with '--today'"
fi
if (( ARG_LAST != 0 )) && (( ARG_DETAIL != 0 ))
if (( ARG_LAST > 0 )) && (( ARG_DETAIL > 0 ))
then
die "you cannot specify '--last' with '--detail'"
fi
if (( ARG_LAST != 0 )) && (( ARG_REVERSE != 0 ))
if (( ARG_LAST > 0 )) && (( ARG_REVERSE > 0 ))
then
die "you cannot specify '--last' with '--detail'"
fi
if (( ARG_LAST != 0 )) && [[ -n "${ARG_FAIL_ID}" ]]
if (( ARG_LAST > 0 )) && [[ -n "${ARG_FAIL_ID}" ]]
then
die "you cannot specify '--last' with '--id'"
fi
if (( ARG_TODAY != 0 )) && (( ARG_DETAIL != 0 ))
if (( ARG_TODAY > 0 )) && (( ARG_DETAIL > 0 ))
then
die "you cannot specify '--today' with '--detail'"
fi
if (( ARG_TODAY != 0 )) && (( ARG_REVERSE != 0 ))
if (( ARG_TODAY > 0 )) && (( ARG_REVERSE > 0 ))
then
die "you cannot specify '--today' with '--detail'"
fi
if (( ARG_TODAY != 0 )) && [[ -n "${ARG_FAIL_ID}" ]]
if (( ARG_TODAY > 0 )) && [[ -n "${ARG_FAIL_ID}" ]]
then
die "you cannot specify '--today' with '--id'"
fi
# switch on history for --last & --today
if (( ARG_LAST != 0 )) || (( ARG_TODAY != 0 ))
if (( ARG_LAST > 0 )) || (( ARG_TODAY > 0 ))
then
ARG_HISTORY=1
fi
fi
if (( DO_REPORT_STD == 0 )) && (( ARG_LAST != 0 ))
if (( DO_REPORT_STD == 0 )) && (( ARG_LAST > 0 ))
then
die "you cannot specify '--last' without '--report'"
fi
if (( DO_REPORT_STD == 0 )) && (( ARG_REVERSE != 0 ))
if (( DO_REPORT_STD == 0 )) && (( ARG_REVERSE > 0 ))
then
die "you cannot specify '--reverse' without '--report'"
fi
if (( DO_REPORT_STD == 0 )) && (( ARG_DETAIL != 0 ))
if (( DO_REPORT_STD == 0 )) && (( ARG_DETAIL > 0 ))
then
die "you cannot specify '--detail' without '--report'"
fi
@ -595,7 +595,7 @@ return 0
# REQUIRES: n/a
function exists_hc
{
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
typeset EXISTS_HC="${1}"
typeset FDIR=""
typeset EXISTS_RC=0
@ -622,7 +622,7 @@ return ${EXISTS_RC}
# REQUIRES: n/a
function find_hc
{
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
typeset FIND_HC="${1}"
typeset FDIR=""
@ -645,7 +645,7 @@ return 0
# the rewrite operation!!
function fix_logs
{
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
typeset FIX_FILE=""
typeset FIX_RC=0
typeset LOG_STASH=""
@ -656,7 +656,7 @@ typeset TMP_COUNT=0
typeset SAVE_TMP_FILE="${TMP_DIR}/.$0.save.log.$$"
typeset TMP_FILE="${TMP_DIR}/.$0.tmp.log.$$"
if (( ARG_HISTORY != 0 ))
if (( ARG_HISTORY > 0 ))
then
set +f # file globbing must be on
LOG_STASH="${HC_LOG} ${ARCHIVE_DIR}/hc.*.log"
@ -812,7 +812,7 @@ return ${FIX_RC}
# REQUIRES: die(), display_*(), notify_*(), warn()
function handle_hc
{
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
typeset HC_NAME="${1}"
typeset HC_STDOUT_LOG_SHORT=""
typeset HC_STDERR_LOG_SHORT=""
@ -831,7 +831,7 @@ then
HC_MSG_VAR=$(<${HC_MSG_FILE})
# DEBUG: dump TMP file
if (( ARG_DEBUG != 0 ))
if (( ARG_DEBUG > 0 ))
then
debug "begin dumping plugin messages file (${HC_MSG_FILE})"
print "${HC_MSG_VAR}"
@ -840,7 +840,7 @@ then
# determine ALL_MSG_STC (sum of all STCs)
ALL_MSG_STC=$(print "${HC_MSG_VAR}" | awk -F"${MSG_SEP}" 'BEGIN { stc = 0 } { for (i=1;i<=NF;i++) { stc = stc + $1 }} END { print stc }' 2>/dev/null)
(( ARG_DEBUG != 0 )) && debug "HC all STC: ${ALL_MSG_STC}"
(( ARG_DEBUG > 0 )) && debug "HC all STC: ${ALL_MSG_STC}"
data_is_numeric ${ALL_MSG_STC} || die "HC all STC computes to a non-numeric value"
else
# nothing to do
@ -978,7 +978,7 @@ then
fi
else
# default STDOUT
if (( ARG_VERBOSE != 0 ))
if (( ARG_VERBOSE > 0 ))
then
print "${HC_MSG_VAR}" | while IFS=${MSG_SEP} read ONE_MSG_STC ONE_MSG_TIME ONE_MSG_TEXT ONE_MSG_CUR_VAL ONE_MSG_EXP_VAL
do
@ -1008,7 +1008,7 @@ then
fi
fi
printf "%s" "INFO: ${HC_NAME} [STC=${ONE_MSG_STC}]: ${ONE_MSG_TEXT}"
if (( ONE_MSG_STC != 0 ))
if (( ONE_MSG_STC > 0 ))
then
printf " %s\n" "[FAIL_ID=${HC_FAIL_ID}]"
else
@ -1020,7 +1020,7 @@ then
fi
# log & notify routines
if (( ARG_LOG != 0 ))
if (( ARG_LOG > 0 ))
then
# log routine (combined STC=0 or <>0)
print "${HC_MSG_VAR}" | while IFS=${MSG_SEP} read ONE_MSG_STC ONE_MSG_TIME ONE_MSG_TEXT ONE_MSG_CUR_VAL ONE_MSG_EXP_VAL
@ -1143,7 +1143,7 @@ fi
# REQUIRES: warn()
function handle_timeout
{
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
[[ -n "${CHILD_PID}" ]] && kill -s TERM ${CHILD_PID}
warn "child process with PID ${CHILD_PID} has been forcefully stopped"
# shellcheck disable=SC2034
@ -1160,7 +1160,7 @@ return 0
# REQUIRES: die()
function init_check_host
{
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
typeset HC_EXEC=""
typeset DISPLAY_STYLE=""
@ -1290,20 +1290,20 @@ return 0
# REQUIRES: die()
function init_hc
{
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
typeset HC_PLATFORMS="${2}"
typeset HC_VERSION="${3}"
typeset HC_OK=0
# check platform (don't use a pattern comparison here (~! mksh/pdksh))
HC_OK=$(print "${HC_PLATFORMS}" | grep -c "${OS_NAME}" 2>/dev/null)
(( HC_OK != 0 )) || die "may only run on platform(s): ${HC_PLATFORMS}"
(( HC_OK > 0 )) || die "may only run on platform(s): ${HC_PLATFORMS}"
# check version of HC plugin
case "${HC_VERSION}" in
[0-2][0-9][0-9][0-9]-[0-1][0-9]-[0-3][0-9])
# OK
(( ARG_DEBUG != 0 )) && debug "HC plugin ${1} has version ${HC_VERSION}"
(( ARG_DEBUG > 0 )) && debug "HC plugin ${1} has version ${HC_VERSION}"
;;
*)
die "version of the HC plugin ${1} is not in YYYY-MM-DD format (${HC_VERSION})"
@ -1321,7 +1321,7 @@ return 0
# REQUIRES: n/a
function is_scheduled
{
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
(( 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/*'
@ -1359,7 +1359,7 @@ return ${CRON_COUNT}
# REQUIRES: n/a
function list_core
{
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
typeset FACTION="${1}"
typeset FCONFIG=""
typeset FDIR=""
@ -1392,7 +1392,7 @@ do
FVERSION=$(grep '^typeset _VERSION=' "${FFILE}" 2>&1 | tr -d '\"' | tr -d ' \t' | cut -f1 -d'#' | cut -f2 -d'=')
# look for configuration file string
HAS_FCONFIG=$(grep -c '^typeset _CONFIG_FILE=' "${FFILE}" 2>&1)
if (( HAS_FCONFIG != 0 ))
if (( HAS_FCONFIG > 0 ))
then
FCONFIG="Yes"
else
@ -1450,7 +1450,7 @@ return 0
# REQUIRES: is_scheduled()
function list_hc
{
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
typeset FACTION="${1}"
typeset FNEEDLE="${2}"
typeset FCONFIG=""
@ -1492,7 +1492,7 @@ do
FVERSION=$(grep '^typeset _VERSION=' "${FFILE}" 2>&1 | tr -d '\"' | tr -d ' \t' | cut -f1 -d'#' | cut -f2 -d'=')
# look for configuration file string
HAS_FCONFIG=$(grep -c '^typeset _CONFIG_FILE=' "${FFILE}" 2>&1)
if (( HAS_FCONFIG != 0 ))
if (( HAS_FCONFIG > 0 ))
then
FCONFIG="Yes"
# *.conf.dist first
@ -1619,20 +1619,20 @@ return 0
# REQUIRES: n/a
function log
{
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
typeset NOW="$(date '+%d-%h-%Y %H:%M:%S')"
typeset LOG_LINE=""
if [[ -n "${1}" ]]
then
if (( ARG_LOG != 0 ))
if (( ARG_LOG > 0 ))
then
print - "$*" | while read -r LOG_LINE
do
print "${NOW}: INFO: [$$]:" "${LOG_LINE}" >>${LOG_FILE}
done
fi
if (( ARG_VERBOSE != 0 ))
if (( ARG_VERBOSE > 0 ))
then
print - "$*" | while read -r LOG_LINE
do
@ -1654,7 +1654,7 @@ return 0
# REQUIRES: n/a
function log_hc
{
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
typeset HC_NAME="${1}"
typeset HC_STC=${2}
typeset HC_NOW="$(date '+%Y-%m-%d %H:%M:%S' 2>/dev/null)"
@ -1708,7 +1708,7 @@ return 0
# REQUIRES: n/a
function show_statistics
{
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
typeset _ARCHIVE_FILE=""
# current events
@ -1806,7 +1806,7 @@ return 0
# REQUIRES: n/a
function stat_hc
{
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
typeset STAT_HC="${1}"
typeset STAT_RC=1 # default: enabled
@ -1823,20 +1823,20 @@ return ${STAT_RC}
# REQUIRES: n/a
function warn
{
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
typeset NOW="$(date '+%d-%h-%Y %H:%M:%S')"
typeset LOG_LINE=""
if [[ -n "${1}" ]]
then
if (( ARG_LOG != 0 ))
if (( ARG_LOG > 0 ))
then
print - "$*" | while read -r LOG_LINE
do
print "${NOW}: WARN: [$$]:" "${LOG_LINE}" >>${LOG_FILE}
done
fi
if (( ARG_VERBOSE != 0 ))
if (( ARG_VERBOSE > 0 ))
then
print - "$*" | while read -r LOG_LINE
do

View File

@ -32,7 +32,7 @@
# REQUIRES: n/a
function data_get_lvalue_from_config
{
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
typeset _PARAMETER="${1}"
typeset _LVALUE=""
typeset _RC=0
@ -58,7 +58,7 @@ return ${_RC}
# REQUIRES: n/a
function data_chop
{
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
print -R "${1%?}" 2>/dev/null
@ -74,7 +74,7 @@ return 0
# REQUIRES: n/a
function data_contains_string
{
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
typeset _HAYSTACK="${1}"
typeset _NEEDLE="${2}"
@ -94,7 +94,7 @@ return ${_RC}
# REQUIRES: n/a
function data_magic_quote
{
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
typeset _SEP="${2:-%}"
typeset _MAGIC="${MAGIC:-!_!}"
@ -112,7 +112,7 @@ return 0
# REQUIRES: n/a
function data_magic_unquote
{
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
typeset _SEP="${2:-%}"
typeset _MAGIC="${MAGIC:-!_!}"
@ -130,7 +130,7 @@ return 0
# REQUIRES: n/a
function data_escape_csv
{
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
print -R "${1}" 2>/dev/null | sed 's#\([;]\)#\\\1#g' 2>/dev/null
@ -146,7 +146,7 @@ return 0
# REQUIRES: n/a
function data_escape_json
{
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
typeset _NEEDLE='[\"]'
print -R "${1}" 2>/dev/null | sed 's#\(["\]\)#\\\1#g' 2>/dev/null
@ -163,7 +163,7 @@ return 0
# REQUIRES: n/a
function data_decomma
{
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
print -R "${1}" 2>/dev/null | tr -d ',' 2>/dev/null
@ -179,7 +179,7 @@ return 0
# REQUIRES: n/a
function data_decomma_last
{
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
print -R "${1%*,}" 2>/dev/null
@ -195,7 +195,7 @@ return 0
# REQUIRES: n/a
function data_decomma_first
{
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
print -R "${1#,*}" 2>/dev/null
@ -211,7 +211,7 @@ return 0
# REQUIRES: n/a
function data_dequote
{
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
print -R "${1}" 2>/dev/null | tr -d '\"' 2>/dev/null | tr -d "'" 2>/dev/null
@ -227,7 +227,7 @@ return 0
# REQUIRES: n/a
function data_comma2space
{
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
print -R "${1}" 2>/dev/null | tr ',' ' ' 2>/dev/null
@ -243,7 +243,7 @@ return 0
# REQUIRES: n/a
function data_comma2pipe
{
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
print -R "${1}" 2>/dev/null | tr ',' '|' 2>/dev/null
@ -259,7 +259,7 @@ return 0
# REQUIRES: n/a
function data_comma2newline
{
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
print -R "${1}" 2>/dev/null | tr ',' '\n' 2>/dev/null
@ -275,7 +275,7 @@ return 0
# REQUIRES: n/a
function data_newline2comma
{
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
print -R "${1}" 2>/dev/null | tr '\n' ',' 2>/dev/null
@ -291,7 +291,7 @@ return 0
# REQUIRES: n/a
function data_newline2hash
{
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
print -R "${1}" 2>/dev/null | tr '\r' '#' 2>/dev/null
@ -307,7 +307,7 @@ return 0
# REQUIRES: n/a
function data_space2comma
{
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
print -R "${1}" 2>/dev/null | tr -s ' ' 2>/dev/null | tr ' ' ',' 2>/dev/null
@ -323,7 +323,7 @@ return 0
# REQUIRES: n/a
function data_pipe2comma
{
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
print -R "${1}" 2>/dev/null | tr -s '|' 2>/dev/null | tr ' '|',' 2>/dev/null
@ -339,7 +339,7 @@ return 0
# REQUIRES: n/a
function data_space2hash
{
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
print -R "${1}" 2>/dev/null | tr -s ' ' 2>/dev/null | tr ' ' '#' 2>/dev/null
@ -355,7 +355,7 @@ return 0
# REQUIRES: n/a
function data_strip_newline
{
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
print -R "${1}" 2>/dev/null | tr -d '\n' 2>/dev/null | tr -d '\r' 2>/dev/null
@ -371,7 +371,7 @@ return 0
# REQUIRES: n/a
function data_strip_space
{
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
print -R "${1}" 2>/dev/null | tr -d '[:space:]' 2>/dev/null
@ -387,7 +387,7 @@ return 0
# REQUIRES: n/a
function data_strip_leading_space
{
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
print -R "${1}" | sed 's/^[[:blank:]]*//' 2>/dev/null
@ -403,7 +403,7 @@ return 0
# REQUIRES: n/a
function data_strip_trailing_space
{
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
print -R "${1}" | sed 's/[[:blank:]]*$//' 2>/dev/null
@ -419,7 +419,7 @@ return 0
# REQUIRES: n/a
function data_strip_outer_space
{
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
print -R "${1}" | sed 's/^[[:blank:]]*//;s/[[:blank:]]*$//' 2>/dev/null
@ -435,7 +435,7 @@ return 0
# REQUIRES: n/a
function data_lc
{
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
print -R "${1}" 2>/dev/null | tr '[:upper:]' '[:lower:]' 2>/dev/null
@ -451,7 +451,7 @@ return 0
# REQUIRES: n/a
function data_uc
{
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
print -R "${1}" 2>/dev/null | tr '[:lower:]' '[:upper:]' 2>/dev/null
@ -467,7 +467,7 @@ return 0
# REQUIRES: n/a
function data_is_numeric
{
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
case "${1}" in
+([0-9])*(.)*([0-9]))
@ -492,7 +492,7 @@ return 0
# REFERENCE: added from http://www.shelldorado.com/scripts/cmds/urlencode
function data_encode_url
{
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
typeset _EncodeEOL=0
LANG=C awk '
@ -546,7 +546,7 @@ return 0
# REFERENCE: https://raw.githubusercontent.com/dualbus/tutorial_nmap/master/iprange
function data_dot2ip
{
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
typeset _DOT="${1}"
typeset _IP=0
typeset _OLD_IFS="${IFS}"
@ -575,7 +575,7 @@ return 0
# REFERENCE: https://raw.githubusercontent.com/dualbus/tutorial_nmap/master/iprange
function data_ip2dot
{
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
typeset _IP="${1}"
typeset _W=""
typeset _X=""
@ -602,7 +602,7 @@ return 0
# REFERENCE: https://raw.githubusercontent.com/dualbus/tutorial_nmap/master/iprange
function data_bits2mask
{
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
typeset _BITS=${1}
typeset _MAX=4294967296
typeset _OFFSET=0
@ -658,7 +658,7 @@ return 0
# REFERENCE: https://raw.githubusercontent.com/dualbus/tutorial_nmap/master/iprange
function data_mask2bits
{
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
typeset _MASK="${1}"
typeset -i _I=32
@ -679,7 +679,7 @@ return 0
# REQUIRES: n/a
function data_is_ipv4
{
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
typeset _IP="${1}"
typeset _RC=0
@ -704,7 +704,7 @@ return ${_RC}
# REFERENCE: https://groups.google.com/forum/#!topic/comp.unix.shell/aPoPzFWP2Og
function data_date2epoch
{
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
typeset _YEAR="${1}"
typeset _MONTH="${2}"
typeset _DAY="${3}"

View File

@ -31,11 +31,11 @@
# REQUIRES: n/a
function linux_get_distro
{
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
# linux only
check_platform 'Linux' || {
(( ARG_DEBUG != 0 )) && debug "may only run on platform(s): Linux"
(( ARG_DEBUG > 0 )) && debug "may only run on platform(s): Linux"
return 1
}
@ -86,11 +86,11 @@ return 0
# REQUIRES: n/a
function linux_get_init
{
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
# linux only
check_platform 'Linux' || {
(( ARG_DEBUG != 0 )) && debug "may only run on platform(s): Linux"
(( ARG_DEBUG > 0 )) && debug "may only run on platform(s): Linux"
return 1
}
@ -117,7 +117,7 @@ return 0
# REQUIRES: n/a
function linux_has_crm
{
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
typeset _CRM_BIN=""
typeset _HAS_CRM=0
@ -134,7 +134,7 @@ then
crm status >/dev/null 2>/dev/null
(( $? == 0 )) && _HAS_CRM=1
else
(( ARG_DEBUG != 0 )) && debug "corosync (crm) is not active here"
(( ARG_DEBUG > 0 )) && debug "corosync (crm) is not active here"
return 1
fi
@ -152,7 +152,7 @@ return 0
# REQUIRES: n/a
function linux_has_docker
{
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
typeset _DOCKER_BIN=""
typeset _HAS_DOCKER=0
@ -169,7 +169,7 @@ then
docker ps >/dev/null 2>/dev/null
(( $? == 0 )) && _HAS_DOCKER=1
else
(( ARG_DEBUG != 0 )) && debug "docker is not active here"
(( ARG_DEBUG > 0 )) && debug "docker is not active here"
return 1
fi
@ -187,7 +187,7 @@ return 0
# REQUIRES: n/a
function linux_has_nm
{
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
typeset _NMCLI_BIN=""
typeset _HAS_NM=0
@ -203,7 +203,7 @@ then
# check for active
_HAS_NM=$(nmcli networking 2>/dev/null | grep -c -i "enabled")
else
(( ARG_DEBUG != 0 )) && debug "NetworkManager is not active here"
(( ARG_DEBUG > 0 )) && debug "NetworkManager is not active here"
return 1
fi

View File

@ -38,7 +38,7 @@ typeset _SUPPORTED_PLATFORMS="AIX,HP-UX,Linux" # uname -s match
# ------------------------- CONFIGURATION ends here ---------------------------
# set defaults
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _EIF_MESSAGE="$1 alert with ID ${HC_FAIL_ID}"
@ -105,7 +105,7 @@ then
_CHILD_RC=$?
kill -s TERM ${_SLEEP_PID} >/dev/null 2>&1
# process return codes
if (( _CHILD_RC != 0 ))
if (( _CHILD_RC > 0 ))
then
warn "problem in sending alert via EIF [RC=${_CHILD_RC}]"
else

View File

@ -35,7 +35,7 @@ typeset _SUPPORTED_PLATFORMS="AIX,HP-UX,Linux" # uname -s match
# ------------------------- CONFIGURATION ends here ---------------------------
# set defaults
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _MAIL_HC="$1"

View File

@ -36,7 +36,7 @@ typeset _SUPPORTED_PLATFORMS="AIX,HP-UX,Linux" # uname -s match
# ------------------------- CONFIGURATION ends here ---------------------------
# set defaults
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _SMS_HC="$1"

View File

@ -35,7 +35,7 @@ typeset _SUPPORTED_PLATFORMS="AIX,HP-UX,Linux" # uname -s match
# ------------------------- CONFIGURATION ends here ---------------------------
# set defaults
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _DIR_PREFIX=""
@ -52,7 +52,7 @@ typeset _LOG_STASH=""
typeset _SORT_CMD=""
# which files do we need to examine
if (( ARG_HISTORY != 0 ))
if (( ARG_HISTORY > 0 ))
then
set +f # file globbing must be on
_LOG_STASH="${HC_LOG} ${ARCHIVE_DIR}/hc.*.log"
@ -61,7 +61,7 @@ else
fi
# --last report
if (( ARG_LAST != 0 ))
if (( ARG_LAST > 0 ))
then
printf "\n| %-30s | %-20s | %-14s | %-4s\n" "HC" "Timestamp" "FAIL ID" "STC (combined value)"
# shellcheck disable=SC2183
@ -113,14 +113,14 @@ then
else
_ID_NEEDLE="[0-9][0-9]*"
[[ -n "${ARG_FAIL_ID}" ]] && _ID_NEEDLE="${ARG_FAIL_ID}"
(( ARG_TODAY != 0 )) && _ID_NEEDLE="$(date '+%Y%m%d')" # refers to timestamp of HC FAIL_ID
(( ARG_TODAY > 0 )) && _ID_NEEDLE="$(date '+%Y%m%d')" # refers to timestamp of HC FAIL_ID
# check fail count (look for unique IDs in the 5th field of the HC log)
_FAIL_COUNT=$(cut -f5 -d"${LOG_SEP}" ${_LOG_STASH} 2>/dev/null | grep -E -e "${_ID_NEEDLE}" | uniq | wc -l)
if (( _FAIL_COUNT != 0 ))
if (( _FAIL_COUNT > 0 ))
then
# check for detail or not?
if (( ARG_DETAIL != 0 )) && (( _FAIL_COUNT != 1 ))
if (( ARG_DETAIL > 0 )) && (( _FAIL_COUNT > 1 ))
then
ARG_LOG=1 die "you must specify a unique FAIL_ID value"
fi

View File

@ -39,7 +39,7 @@ typeset _SUPPORTED_PLATFORMS="AIX" # uname -s match
# ------------------------- CONFIGURATION ends here ---------------------------
# set defaults
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*")
typeset _ARG=""

View File

@ -38,7 +38,7 @@ typeset _SUPPORTED_PLATFORMS="AIX" # uname -s match
# ------------------------- CONFIGURATION ends here ---------------------------
# set defaults
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*")
typeset _ARG=""
@ -104,7 +104,7 @@ do
_STC=1
else
_AGE_CHECK=$(find "${_FILE_DIR}" -type f -name "${_FILE_NAME}" -mmin -"${_FILE_AGE}")
if (( $? != 0 ))
if (( $? > 0 ))
then
warn "unable to execute file age test for ${_FILE_PATH}"
return 1

View File

@ -39,7 +39,7 @@ typeset _SUPPORTED_PLATFORMS="Linux" # uname -s match
# ------------------------- CONFIGURATION ends here ---------------------------
# set defaults
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*")
typeset _ARG=""
@ -297,7 +297,7 @@ do
fi
# bounce failures back and jump to next file
if (( _STC != 0 ))
if (( _STC > 0 ))
then
log_hc "$0" ${_STC} "${_MSG}"
continue
@ -327,7 +327,7 @@ do
done <${_TMP1_FILE}
# update state file (also if TMP2_FILE is empty)
if (( ARG_LOG != 0 ))
if (( ARG_LOG > 0 ))
then
[[ -s ${_TMP2_FILE} ]] || {
warn "no files found to check, zeroing new state file"

View File

@ -36,7 +36,7 @@ typeset _SUPPORTED_PLATFORMS="AIX" # uname -s match
# ------------------------- CONFIGURATION ends here ---------------------------
# set defaults
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*")
typeset _ARG=""

View File

@ -36,7 +36,7 @@ typeset _SUPPORTED_PLATFORMS="AIX" # uname -s match
# ------------------------- CONFIGURATION ends here ---------------------------
# set defaults
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*")
typeset _ARG=""

View File

@ -36,7 +36,7 @@ typeset _SUPPORTED_PLATFORMS="AIX" # uname -s match
# ------------------------- CONFIGURATION ends here ---------------------------
# set defaults
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*")
typeset _ARG=""

View File

@ -37,7 +37,7 @@ typeset _SUPPORTED_PLATFORMS="AIX" # uname -s match
# ------------------------- CONFIGURATION ends here ---------------------------
# set defaults
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*")
typeset _ARG=""

View File

@ -37,7 +37,7 @@ typeset _SUPPORTED_PLATFORMS="AIX" # uname -s match
# ------------------------- CONFIGURATION ends here ---------------------------
# set defaults
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*")
typeset _ARG=""

View File

@ -39,7 +39,7 @@ typeset _SUPPORTED_PLATFORMS="AIX" # uname -s match
# ------------------------- CONFIGURATION ends here ---------------------------
# set defaults
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*")
typeset _ARG=""

View File

@ -37,7 +37,7 @@ typeset _SUPPORTED_PLATFORMS="AIX" # uname -s match
# ------------------------- CONFIGURATION ends here ---------------------------
# set defaults
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*")
typeset _ARG=""
@ -64,7 +64,7 @@ topasrec -l >>${HC_STDOUT_LOG} 2>>${HC_STDERR_LOG}
_TOPAS=$(grep -c "bin" ${HC_STDOUT_LOG} 2>/dev/null)
_NMON=$(grep -c "nmon" ${HC_STDOUT_LOG} 2>/dev/null)
_MSG="process checks: nmon=${_NMON}; topasrec=${_TOPAS}"
if (( _NMON != 1 || _TOPAS != 1 ))
if (( _NMON > 1 || _TOPAS > 1 ))
then
_STC=1
fi

View File

@ -39,7 +39,7 @@ typeset _SUPPORTED_PLATFORMS="HP-UX" # uname -s match
# ------------------------- CONFIGURATION ends here ---------------------------
# set defaults
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*")
typeset _ARG=""
@ -69,11 +69,11 @@ fi
# collect autopath info
log "collecting autopath information, this may take a while ..."
${_AUTOPATH_BIN} display >>${HC_STDOUT_LOG} 2>>${HC_STDERR_LOG}
(( $? != 0 )) && {
(( $? > 0 )) && {
_MSG="unable to run {${_AUTOPATH_BIN}}"
log_hc "$0" 1 "${_MSG}"
# dump debug info
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && dump_logs
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && dump_logs
return 0
}

View File

@ -37,7 +37,7 @@ typeset _CDSF_BIN="/usr/sbin/io_cdsf_config"
# ------------------------- CONFIGURATION ends here ---------------------------
# set defaults
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*")
typeset _ARG=""
@ -79,7 +79,7 @@ else
# io_cdsf_config outputs on STDERR (run status & check)
# stable cluster: RC=0
${_CDSF_BIN} -s >${HC_STDOUT_LOG} 2>${HC_STDOUT_LOG}
(( $? != 0 )) && {
(( $? > 0 )) && {
log_hc "$0" 1 "cDSF cluster has not yet been initialized or is not stable"
return 0
}

View File

@ -44,7 +44,7 @@ typeset _SUPPORTED_PLATFORMS="HP-UX" # uname -s match
# ------------------------- CONFIGURATION ends here ---------------------------
# set defaults
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*")
typeset _ARG=""
@ -247,7 +247,7 @@ else
_MSG="unable to run command: {${_DRD_BIN}}"
log_hc "$0" 1 "${_MSG}"
# dump debug info
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && dump_logs
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && dump_logs
return 1
fi

View File

@ -1,4 +1,4 @@
#!/usr/bin/env ksh
>#!/usr/bin/env ksh
#******************************************************************************
# @(#) check_hpux_file_age.sh
#******************************************************************************
@ -39,7 +39,7 @@ typeset _SUPPORTED_PLATFORMS="HP-UX" # uname -s match
# ------------------------- CONFIGURATION ends here ---------------------------
# set defaults
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*")
typeset _ARG=""
@ -109,13 +109,13 @@ do
if (( _DO_REF == 0 ))
then
REF_TIME=$(perl -e "use POSIX;\$t=time-(${_FILE_AGE}*60);print(strftime '%m%d%H%M',localtime(\$t))")
if (( $? != 0 ))
if (( $? > 0 ))
then
warn "failed to query reference time (Perl)"
return 1
fi
touch -amt "${REF_TIME}" ${_REF_FILE} >>${HC_STDOUT_LOG} 2>>${HC_STDERR_LOG}
if (( $? != 0 ))
if (( $? > 0 ))
then
warn "failed to create reference time ${TMP_DIR}"
return 1

View File

@ -39,7 +39,7 @@ typeset _SUPPORTED_PLATFORMS="HP-UX" # uname -s match
# ------------------------- CONFIGURATION ends here ---------------------------
# set defaults
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*")
typeset _ARG=""
@ -297,7 +297,7 @@ do
fi
# bounce failures back and jump to next file
if (( _STC != 0 ))
if (( _STC > 0 ))
then
log_hc "$0" ${_STC} "${_MSG}"
continue
@ -327,7 +327,7 @@ do
done <${_TMP1_FILE}
# update state file (also if TMP2_FILE is empty)
if (( ARG_LOG != 0 ))
if (( ARG_LOG > 0 ))
then
[[ -s ${_TMP2_FILE} ]] || {
warn "no files found to check, zeroing new state file"

View File

@ -38,7 +38,7 @@ typeset _SUPPORTED_PLATFORMS="HP-UX" # uname -s match
# ------------------------- CONFIGURATION ends here ---------------------------
# set defaults
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*")
typeset _ARG=""

View File

@ -40,7 +40,7 @@ typeset _SUPPORTED_PLATFORMS="HP-UX" # uname -s match
# ------------------------- CONFIGURATION ends here ---------------------------
# set defaults
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*")
typeset _ARG=""

View File

@ -37,7 +37,7 @@ typeset _SUPPORTED_PLATFORMS="HP-UX" # uname -s match
# ------------------------- CONFIGURATION ends here ---------------------------
# set defaults
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*")
typeset _ARG=""
@ -74,7 +74,7 @@ else
fi
# 2) try the pgrep way (note: old pgreps do not support '-c')
if (( _RC != 0 ))
if (( _RC > 0 ))
then
# we need guidkeyd & guidd
(( $(pgrep -P 1 -u root guidd 2>>${HC_STDERR_LOG} | wc -l) == 0 )) && _STC=1

View File

@ -41,7 +41,7 @@ typeset _SUPPORTED_PLATFORMS="HP-UX" # uname -s match
# ------------------------- CONFIGURATION ends here ---------------------------
# set defaults
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*")
typeset _ARG=""
@ -76,11 +76,11 @@ then
fi
${_HPVMSTATUS_BIN} -M >>${HC_STDOUT_LOG} 2>>${HC_STDERR_LOG}
(( $? != 0 )) && {
(( $? > 0 )) && {
_MSG="unable to run command: {${_HPVMSTATUS_BIN}}"
log_hc "$0" 1 "${_MSG}"
# dump debug info
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && dump_logs
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && dump_logs
return 0
}

View File

@ -38,7 +38,7 @@ typeset _SUPPORTED_PLATFORMS="HP-UX" # uname -s match
# ------------------------- CONFIGURATION ends here ---------------------------
# set defaults
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*")
typeset _ARG=""
@ -76,7 +76,7 @@ else
fi
# 2) try the pgrep way (note: old pgreps do not support '-c')
if (( _RC != 0 ))
if (( _RC > 0 ))
then
(( $(pgrep -u root httpd 2>>${HC_STDERR_LOG} | wc -l) == 0 )) && _STC=1
fi

View File

@ -43,7 +43,7 @@ typeset _SUPPORTED_PLATFORMS="HP-UX" # uname -s match
# ------------------------- CONFIGURATION ends here ---------------------------
# set defaults
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*")
typeset _ARG=""
@ -100,7 +100,7 @@ then
_MSG="unable to run command: cd /var/opt/ignite/clients"
log_hc "$0" 1 "${_MSG}"
# dump debug info
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && dump_logs
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && dump_logs
return 1
fi
@ -185,7 +185,7 @@ then
_MSG="unable to run command: cd /var/opt/ignite/clients"
log_hc "$0" 1 "${_MSG}"
# dump debug info
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && dump_logs
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && dump_logs
return 1
fi
else

View File

@ -46,7 +46,7 @@ typeset _SUPPORTED_PLATFORMS="HP-UX" # uname -s match
# ------------------------- CONFIGURATION ends here ---------------------------
# set defaults
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*")
typeset _ARG=""
@ -127,12 +127,12 @@ else
fi
log "executing ioscan with options: ${_IOSCAN_OPTS}"
${_IOSCAN_BIN} ${_IOSCAN_OPTS} >>${HC_STDOUT_LOG} 2>>${HC_STDERR_LOG}
if (( $? != 0 ))
if (( $? > 0 ))
then
_MSG="unable to run command: {${_IOSCAN_BIN}}"
log_hc "$0" 1 "${_MSG}"
# dump debug info
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && dump_logs
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && dump_logs
return 1
fi
fi

View File

@ -41,7 +41,7 @@ typeset _SUPPORTED_PLATFORMS="HP-UX" # uname -s match
# ------------------------- CONFIGURATION ends here ---------------------------
# set defaults
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*")
typeset _ARG=""
@ -80,12 +80,12 @@ then
return 1
else
${_KCTUNE_BIN} >>${HC_STDOUT_LOG} 2>>${HC_STDERR_LOG}
if (( $? != 0 ))
if (( $? > 0 ))
then
_MSG="unable to gather kctune information"
log_hc "$0" 1 "${_MSG}"
# dump debug info
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && dump_logs
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && dump_logs
return 0
fi
fi

View File

@ -42,7 +42,7 @@ typeset _SUPPORTED_PLATFORMS="HP-UX" # uname -s match
# ------------------------- CONFIGURATION ends here ---------------------------
# set defaults
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*")
typeset _ARG=""
@ -97,11 +97,11 @@ then
return 1
else
${_KCUSAGE_BIN} >>${HC_STDOUT_LOG} 2>>${HC_STDERR_LOG}
if (( $? != 0 ))
if (( $? > 0 ))
then
_MSG="unable to gather kcusage information"
# dump debug info
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && dump_logs
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && dump_logs
log_hc "$0" 1 "${_MSG}"
return 0
fi
@ -176,7 +176,7 @@ do
# parameter excluded?
if (( $(print "${_EXCLUDED_PARAMS}" | tr ',' '\n' | grep -c -E -e "${_PARAM_NAME}") != 0 ))
then
(( ARG_DEBUG != 0 )) && debug "excluding kernel parameter ${_PARAM_NAME} ..."
(( ARG_DEBUG > 0 )) && debug "excluding kernel parameter ${_PARAM_NAME} ..."
continue
fi

View File

@ -42,7 +42,7 @@ typeset _SUPPORTED_PLATFORMS="HP-UX" # uname -s match
# ------------------------- CONFIGURATION ends here ---------------------------
# set defaults
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*")
typeset _ARG=""
@ -117,7 +117,7 @@ fi
}
# get all disk LUNs
(( ARG_DEBUG != 0 )) && debug "collecting ioscan information"
(( ARG_DEBUG > 0 )) && debug "collecting ioscan information"
print "=== ioscan ===" >>${HC_STDOUT_LOG}
${_IOSCAN_BIN} ${_IOSCAN_OPTS} >${_TMP1_FILE} 2>>${HC_STDERR_LOG}
if (( $? > 0 ))
@ -125,24 +125,24 @@ then
_MSG="unable to gather ioscan information"
log_hc "$0" 1 "${_MSG}"
# dump debug info
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && dump_logs
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && dump_logs
return 1
fi
# collect scsimgr info for all LUNs
(( ARG_DEBUG != 0 )) && debug "collecting scsimgr information"
(( ARG_DEBUG > 0 )) && debug "collecting scsimgr information"
${_SCSIMGR_BIN} ${_SCSIMGR_OPTS} >${_TMP2_FILE} 2>>${HC_STDERR_LOG}
if (( $? > 0 ))
then
_MSG="unable to gather scsimgr information"
log_hc "$0" 1 "${_MSG}"
# dump debug info
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && dump_logs
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && dump_logs
return 1
fi
# parse ioscan + scsimgr results (WWID is the glue)
(( ARG_DEBUG != 0 )) && debug "glueing ioscan & scsimgr information together"
(( ARG_DEBUG > 0 )) && debug "glueing ioscan & scsimgr information together"
awk 'BEGIN { wwid = ""; active_paths = ""; all_paths = ""; failed_paths = ""; standby_paths = ""; }
{

View File

@ -37,7 +37,7 @@ typeset _SUPPORTED_PLATFORMS="HP-UX" # uname -s match
# ------------------------- CONFIGURATION ends here ---------------------------
# set defaults
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _NAMED_CHECKCONF_BIN=""
typeset _NAMED_PID=""
@ -75,7 +75,7 @@ else
fi
# 2) try the pgrep way (note: old pgreps do not support '-c')
if (( _RC != 0 ))
if (( _RC > 0 ))
then
(( $(pgrep -u root named 2>>${HC_STDERR_LOG} | wc -l) == 0 )) && _STC=1
fi

View File

@ -41,7 +41,7 @@ typeset _NTPQ_BIN="/usr/sbin/ntpq"
# ------------------------- CONFIGURATION ends here ---------------------------
# set defaults
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*")
typeset _ARG=""

View File

@ -43,7 +43,7 @@ typeset _OVPA_BIN="/opt/perf/bin/perfstat"
# ------------------------- CONFIGURATION ends here ---------------------------
# set defaults
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*")
typeset _ARG=""

View File

@ -45,7 +45,7 @@ typeset _SUPPORTED_PLATFORMS="HP-UX" # uname -s match
# ------------------------- CONFIGURATION ends here ---------------------------
# set defaults
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*")
typeset _ARG=""
@ -163,7 +163,7 @@ then
_MSG="unable to run command: {${_SWLIST_BIN}}"
log_hc "$0" 1 "${_MSG}"
# dump debug info
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && dump_logs
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && dump_logs
return 1
fi
else
@ -209,7 +209,7 @@ then
_MSG="unable to run command: {${_SHOW_PATCHES_BIN}}"
log_hc "$0" 1 "${_MSG}"
# dump debug info
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && dump_logs
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && dump_logs
return 1
fi
else
@ -241,7 +241,7 @@ then
_MSG="unable to run command: {${_SWLIST_BIN}}"
log_hc "$0" 1 "${_MSG}"
# dump debug info
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && dump_logs
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && dump_logs
return 1
fi
fi

View File

@ -36,7 +36,7 @@ typeset _SUPPORTED_PLATFORMS="HP-UX" # uname -s match
# ------------------------- CONFIGURATION ends here ---------------------------
# set defaults
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*")
typeset _ARG=""

View File

@ -37,7 +37,7 @@ typeset _SUPPORTED_PLATFORMS="HP-UX" # uname -s match
# ------------------------- CONFIGURATION ends here ---------------------------
# set defaults
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*")
typeset _ARG=""

View File

@ -41,7 +41,7 @@ typeset _SUPPORTED_PLATFORMS="HP-UX" # uname -s match
# ------------------------- CONFIGURATION ends here ---------------------------
# set defaults
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*")
typeset _ARG=""
@ -238,7 +238,7 @@ then
# save cimprovider OUTPUT
print "${_CHECK_CIM_OUTPUT}" >>${HC_STDOUT_LOG}
# dump debug info
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && dump_logs
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && dump_logs
return 1
else
# find module
@ -310,7 +310,7 @@ then
_MSG="unable to execute {${_SFMCONFIG_BIN} -t -a}, cimserver is probably not running"
log_hc "$0" 1 "${_MSG}"
# dump debug info
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && dump_logs
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && dump_logs
return 1
else
# wait for test event to showing
@ -326,7 +326,7 @@ then
# save evweb OUTPUT
print "${_CHECK_EVWEB_OUTPUT}" >>${HC_STDOUT_LOG}
# dump debug info
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && dump_logs
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && dump_logs
return 1
else
if [[ -n "${_CHECK_EVWEB_OUTPUT}" ]]
@ -361,7 +361,7 @@ then
# save evweb OUTPUT
print "${_CHECK_EVWEB_OUTPUT}" >>${HC_STDOUT_LOG}
# dump debug info
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && dump_logs
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && dump_logs
return 1
else
_CFG_EVENTS_SEVERITY=$(data_lc "${_CFG_EVENTS_SEVERITY}")

View File

@ -42,7 +42,7 @@ typeset _SG_CMGETCONF_FILTER="Permission denied|Number of configured"
# ------------------------- CONFIGURATION ends here ---------------------------
# set defaults
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*")
typeset _ARG=""

View File

@ -42,7 +42,7 @@ typeset _SG_DAEMON="/usr/lbin/cmcld"
# ------------------------- CONFIGURATION ends here ---------------------------
# set defaults
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*")
typeset _ARG=""
@ -79,11 +79,11 @@ then
return 1
else
cmviewcl -v -f line 2>>${HC_STDERR_LOG} | tr '|' ':' >>${HC_STDOUT_LOG}
(( $? != 0 )) && {
(( $? > 0 )) && {
_MSG="unable to run command: {cmviewcl}"
log_hc "$0" 1 "${_MSG}"
# dump debug info
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && dump_logs
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && dump_logs
return 0
}
fi

View File

@ -42,7 +42,7 @@ typeset _SG_CMGETCONF_FILTER="Permission denied|Number of configured"
# ------------------------- CONFIGURATION ends here ---------------------------
# set defaults
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*")
typeset _ARG=""

View File

@ -42,7 +42,7 @@ typeset _SG_DAEMON="/usr/lbin/cmcld"
# ------------------------- CONFIGURATION ends here ---------------------------
# set defaults
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*")
typeset _ARG=""
@ -80,11 +80,11 @@ then
return 1
else
cmviewcl -v -f line -l package 2>>${HC_STDERR_LOG} | tr '|' ':' >>${HC_STDOUT_LOG}
(( $? != 0)) && {
(( $? > 0)) && {
_MSG="unable to run command: {cmviewcl}"
log_hc "$0" 1 "${_MSG}"
# dump debug info
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && dump_logs
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && dump_logs
return 0
}
fi

View File

@ -39,7 +39,7 @@ typeset _QS_AUTH_FILE="/etc/cmcluster/qs_authfile"
# ------------------------- CONFIGURATION ends here ---------------------------
# set defaults
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*")
typeset _ARG=""

View File

@ -38,7 +38,7 @@ typeset _SUPPORTED_PLATFORMS="HP-UX" # uname -s match
# ------------------------- CONFIGURATION ends here ---------------------------
# set defaults
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*")
typeset _ARG=""
@ -75,7 +75,7 @@ else
fi
# 2) try the pgrep way (note: old pgreps do not support '-c')
if (( _RC != 0 ))
if (( _RC > 0 ))
then
(( $(pgrep -P 1 -u root sshd 2>>${HC_STDERR_LOG} | wc -l) == 0 )) && _STC=1
fi

View File

@ -40,7 +40,7 @@ typeset _SUPPORTED_PLATFORMS="HP-UX" # uname -s match
# ------------------------- CONFIGURATION ends here ---------------------------
# set defaults
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*")
typeset _ARG=""
@ -132,7 +132,7 @@ then
warn "failed to sort temporary state file"
return 1
}
if (( ARG_LOG != 0 ))
if (( ARG_LOG > 0 ))
then
mv ${_TMP_FILE} ${_STATE_FILE} >/dev/null 2>&1
(( $? > 0 )) && {

View File

@ -36,7 +36,7 @@ typeset _SUPPORTED_PLATFORMS="HP-UX" # uname -s match
# ------------------------- CONFIGURATION ends here ---------------------------
# set defaults
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*")
typeset _ARG=""

View File

@ -44,7 +44,7 @@ typeset _SUPPORTED_PLATFORMS="Linux" # uname -s match
# ------------------------- CONFIGURATION ends here ---------------------------
# set defaults
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*")
typeset _ARG=""
@ -101,7 +101,7 @@ fi
# burp v1 or v2?
_BURP_VERSION="$(${_BURP_BIN} -v 2>/dev/null)"
(( ARG_DEBUG != 0 )) && debug "burp version: ${_BURP_VERSION}"
(( ARG_DEBUG > 0 )) && debug "burp version: ${_BURP_VERSION}"
case "${_BURP_VERSION}" in
burp-2*)
# check for burp server

View File

@ -40,7 +40,7 @@ typeset _SUPPORTED_PLATFORMS="Linux" # uname -s match
# ------------------------- CONFIGURATION ends here ---------------------------
# set defaults
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*")
typeset _ARG=""
@ -86,7 +86,7 @@ case "${LINUX_INIT}" in
esac
# 2) try the pgrep way (note: old pgreps do not support '-c')
if (( _RC != 0 ))
if (( _RC > 0 ))
then
(( $(pgrep -u root burp 2>>${HC_STDERR_LOG} | wc -l 2>/dev/null) == 0 )) && _STC=1
fi

View File

@ -39,7 +39,7 @@ typeset _SUPPORTED_PLATFORMS="Linux" # uname -s match
# ------------------------- CONFIGURATION ends here ---------------------------
# set defaults
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*")
typeset _ARG=""
@ -105,7 +105,7 @@ do
_STC=1
else
_AGE_CHECK=$(find "${_FILE_DIR}" -type f -name "${_FILE_NAME}" -mmin -"${_FILE_AGE}" 2>/dev/null)
if (( $? != 0 ))
if (( $? > 0 ))
then
warn "unable to execute file age test for ${_FILE_PATH}"
return 1

View File

@ -40,7 +40,7 @@ typeset _SUPPORTED_PLATFORMS="Linux" # uname -s match
# ------------------------- CONFIGURATION ends here ---------------------------
# set defaults
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*")
typeset _ARG=""
@ -298,7 +298,7 @@ do
fi
# bounce failures back and jump to next file
if (( _STC != 0 ))
if (( _STC > 0 ))
then
log_hc "$0" ${_STC} "${_MSG}"
continue
@ -328,7 +328,7 @@ do
done <${_TMP1_FILE}
# update state file (also if TMP2_FILE is empty)
if (( ARG_LOG != 0 ))
if (( ARG_LOG > 0 ))
then
[[ -s ${_TMP2_FILE} ]] || {
warn "no files found to check, zeroing new state file"

View File

@ -39,7 +39,7 @@ typeset _SUPPORTED_PLATFORMS="Linux" # uname -s match
# ------------------------- CONFIGURATION ends here ---------------------------
# set defaults
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*")
typeset _ARG=""

View File

@ -39,7 +39,7 @@ typeset _SUPPORTED_PLATFORMS="Linux" # uname -s match
# ------------------------- CONFIGURATION ends here ---------------------------
# set defaults
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*")
typeset _ARG=""
@ -133,7 +133,7 @@ esac
# check for dependencies: we need to do DO_ACU_CTRL to have the slot info for all
# the other checks
_DO_CHECK=$(( _DO_ACU_ENCL + _DO_ACU_PHYS + _DO_ACU_LOGL ))
if (( _DO_CHECK != 0 && _DO_ACU_CTRL == 0 ))
if (( _DO_CHECK > 0 && _DO_ACU_CTRL == 0 ))
then
log "switching setting 'do_acu_controller' to 1 to fetch slot info"
_DO_ACU_CTRL=1
@ -148,10 +148,10 @@ fi
# --- perform checks ---
# CONTROLLER(s)
if (( _DO_ACU_CTRL != 0 ))
if (( _DO_ACU_CTRL > 0 ))
then
${_HPACUCLI_BIN} controller all show status >${_TMP_FILE} 2>${_TMP_FILE}
(( $? != 0 )) && warn "'${_HPACUCLI_BIN} controller all show status' exited non-zero"
(( $? > 0 )) && warn "'${_HPACUCLI_BIN} controller all show status' exited non-zero"
# look for failures
grep -i -E -e "(nok|fail.*)" ${_TMP_FILE} 2>/dev/null |\
while read _ACU_LINE
@ -183,13 +183,13 @@ else
fi
# ENCLOSURE(s)
if (( _DO_ACU_ENCL != 0 ))
if (( _DO_ACU_ENCL > 0 ))
then
for _CTRL_SLOT in ${_SLOT_NUMS}
do
${_HPACUCLI_BIN} controller slot=${_CTRL_SLOT} enclosure all show \
>${_TMP_FILE} 2>${_TMP_FILE}
(( $? != 0 )) && \
(( $? > 0 )) && \
warn "'${_HPACUCLI_BIN} controller slot=${_CTRL_SLOT} enclosure all show' exited non-zero"
# look for failures
grep -i -E -e "(nok|fail.*)" ${_TMP_FILE} 2>/dev/null |\
@ -208,13 +208,13 @@ else
fi
# PHYSICAL DRIVE(s)
if (( _DO_ACU_PHYS != 0 ))
if (( _DO_ACU_PHYS > 0 ))
then
for _CTRL_SLOT in ${_SLOT_NUMS}
do
${_HPACUCLI_BIN} controller slot=${_CTRL_SLOT} physicaldrive all show status \
>${_TMP_FILE} 2>${_TMP_FILE}
(( $? != 0 )) && \
(( $? > 0 )) && \
warn "'${_HPACUCLI_BIN} controller slot=${_CTRL_SLOT} physicaldrive all show status' exited non-zero"
# look for failures
grep -i -E -e "(nok|fail.*)" ${_TMP_FILE} 2>/dev/null |\
@ -233,13 +233,13 @@ else
fi
# LOGICAL DRIVE(s)
if (( _DO_ACU_LOGL != 0 ))
if (( _DO_ACU_LOGL > 0 ))
then
for _CTRL_SLOT in ${_SLOT_NUMS}
do
${_HPACUCLI_BIN} controller slot=${_CTRL_SLOT} logicaldrive all show status \
>${_TMP_FILE} 2>${_TMP_FILE}
(( $? != 0 )) && \
(( $? > 0 )) && \
warn "'${_HPACUCLI_BIN} controller slot=${_CTRL_SLOT}logicaldrive all show status' exited non-zero"
# look for failures
grep -i -E -e "(nok|fail)" ${_TMP_FILE} 2>/dev/null |\

View File

@ -40,7 +40,7 @@ typeset _SUPPORTED_PLATFORMS="Linux" # uname -s match
# ------------------------- CONFIGURATION ends here ---------------------------
# set defaults
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*")
typeset _ARG=""
@ -156,10 +156,10 @@ fi
# --- perform checks ---
# SHOW FANS
if (( _DO_ASM_FANS != 0 ))
if (( _DO_ASM_FANS > 0 ))
then
${_HPASMCLI_BIN} -s 'SHOW FANS' >${_TMP_FILE} 2>${_TMP_FILE}
(( $? != 0 )) && warn "'${_HPASMCLI_BIN} -s SHOW FANS' exited non-zero"
(( $? > 0 )) && warn "'${_HPASMCLI_BIN} -s SHOW FANS' exited non-zero"
# look for failures
grep -E -e '^#' ${_TMP_FILE} 2>/dev/null | grep -vi 'normal' 2>/dev/null |\
while read _ASM_LINE
@ -177,10 +177,10 @@ else
fi
# SHOW DIMM
if (( _DO_ASM_DIMM != 0 ))
if (( _DO_ASM_DIMM > 0 ))
then
${_HPASMCLI_BIN} -s 'SHOW DIMM' >${_TMP_FILE} 2>${_TMP_FILE}
(( $? != 0 )) && warn "'${_HPASMCLI_BIN} -s SHOW DIMM' exited non-zero"
(( $? > 0 )) && warn "'${_HPASMCLI_BIN} -s SHOW DIMM' exited non-zero"
# look for failures
grep -i -E -e "(nok|fail)" ${_TMP_FILE} 2>/dev/null |\
while read _ASM_LINE
@ -197,10 +197,10 @@ else
fi
# SHOW POWERSUPPLY
if (( _DO_ASM_POWR != 0 ))
if (( _DO_ASM_POWR > 0 ))
then
${_HPASMCLI_BIN} -s 'SHOW POWERSUPPLY' >${_TMP_FILE} 2>${_TMP_FILE}
(( $? != 0 )) && warn "'${_HPASMCLI_BIN} -s SHOW POWERSUPPLY' exited non-zero"
(( $? > 0 )) && warn "'${_HPASMCLI_BIN} -s SHOW POWERSUPPLY' exited non-zero"
# look for failures
grep -i -E -e "(nok|fail)" ${_TMP_FILE} 2>/dev/null |\
while read _ASM_LINE
@ -217,10 +217,10 @@ else
fi
# SHOW SERVER
if (( _DO_ASM_SRVR != 0 ))
if (( _DO_ASM_SRVR > 0 ))
then
${_HPASMCLI_BIN} -s 'SHOW SERVER' >${_TMP_FILE} 2>${_TMP_FILE}
(( $? != 0 )) && warn "'${_HPASMCLI_BIN} -s SHOW SERVER' exited non-zero"
(( $? > 0 )) && warn "'${_HPASMCLI_BIN} -s SHOW SERVER' exited non-zero"
# look for failures
grep -i -E -e "(nok|fail)" ${_TMP_FILE} 2>/dev/null |\
while read _ASM_LINE
@ -237,10 +237,10 @@ else
fi
# SHOW TEMP
if (( _DO_ASM_TEMP != 0 ))
if (( _DO_ASM_TEMP > 0 ))
then
${_HPASMCLI_BIN} -s 'SHOW TEMP' >${_TMP_FILE} 2>${_TMP_FILE}
(( $? != 0 )) && warn "'${_HPASMCLI_BIN} -s SHOW TEMP' exited non-zero"
(( $? > 0 )) && warn "'${_HPASMCLI_BIN} -s SHOW TEMP' exited non-zero"
# look for failures
grep -E -e '^#' ${_TMP_FILE} 2>/dev/null |\
while read _ASM_LINE

View File

@ -40,7 +40,7 @@ typeset _SUPPORTED_PLATFORMS="Linux" # uname -s match
# ------------------------- CONFIGURATION ends here ---------------------------
# set defaults
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*")
typeset _ARG=""
@ -114,11 +114,11 @@ fi
# get hplog output
${_HPLOG_BIN} -v >${HC_STDOUT_LOG} 2>>${HC_STDERR_LOG}
(( $? != 0 )) && {
(( $? > 0 )) && {
_MSG="unable to run ${_HPLOG_BIN}"
log_hc "$0" 1 "${_MSG}"
# dump debug info
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && dump_logs
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && dump_logs
return 0
}

View File

@ -39,7 +39,7 @@ typeset _SUPPORTED_PLATFORMS="Linux" # uname -s match
# ------------------------- CONFIGURATION ends here ---------------------------
# set defaults
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*")
typeset _ARG=""
@ -133,7 +133,7 @@ esac
# check for dependencies: we need to do DO_SSA_CTRL to have the slot info for all
# the other checks
_DO_CHECK=$(( _DO_SSA_ENCL + _DO_SSA_PHYS + _DO_SSA_LOGL ))
if (( _DO_CHECK != 0 && _DO_SSA_CTRL == 0 ))
if (( _DO_CHECK > 0 && _DO_SSA_CTRL == 0 ))
then
log "switching setting 'do_ssa_controller' to 1 to fetch slot info"
_DO_SSA_CTRL=1
@ -148,10 +148,10 @@ fi
# --- perform checks ---
# CONTROLLER(s)
if (( _DO_SSA_CTRL != 0 ))
if (( _DO_SSA_CTRL > 0 ))
then
${_HPSSACLI_BIN} controller all show status >${_TMP_FILE} 2>${_TMP_FILE}
(( $? != 0 )) && warn "'${_HPSSACLI_BIN} controller all show status' exited non-zero"
(( $? > 0 )) && warn "'${_HPSSACLI_BIN} controller all show status' exited non-zero"
# look for failures
grep -i -E -e "(nok|fail.*)" ${_TMP_FILE} 2>/dev/null |\
while read _SSA_LINE
@ -183,13 +183,13 @@ else
fi
# ENCLOSURE(s)
if (( _DO_SSA_ENCL != 0 ))
if (( _DO_SSA_ENCL > 0 ))
then
for _CTRL_SLOT in ${_SLOT_NUMS}
do
${_HPSSACLI_BIN} controller slot=${_CTRL_SLOT} enclosure all show \
>${_TMP_FILE} 2>${_TMP_FILE}
(( $? != 0 )) && \
(( $? > 0 )) && \
warn "'${_HPSSACLI_BIN} controller slot=${_CTRL_SLOT} enclosure all show' exited non-zero"
# look for failures
grep -i -E -e "(nok|fail.*)" ${_TMP_FILE} 2>/dev/null |\
@ -208,13 +208,13 @@ else
fi
# PHYSICAL DRIVE(s)
if (( _DO_SSA_PHYS != 0 ))
if (( _DO_SSA_PHYS > 0 ))
then
for _CTRL_SLOT in ${_SLOT_NUMS}
do
${_HPSSACLI_BIN} controller slot=${_CTRL_SLOT} physicaldrive all show status \
>${_TMP_FILE} 2>${_TMP_FILE}
(( $? != 0 )) && \
(( $? > 0 )) && \
warn "'${_HPSSACLI_BIN} controller slot=${_CTRL_SLOT} physicaldrive all show status' exited non-zero"
# look for failures
grep -i -E -e "(nok|fail.*)" ${_TMP_FILE} 2>/dev/null |\
@ -233,13 +233,13 @@ else
fi
# LOGICAL DRIVE(s)
if (( _DO_SSA_LOGL != 0 ))
if (( _DO_SSA_LOGL > 0 ))
then
for _CTRL_SLOT in ${_SLOT_NUMS}
do
${_HPSSACLI_BIN} controller slot=${_CTRL_SLOT} logicaldrive all show status \
>${_TMP_FILE} 2>${_TMP_FILE}
(( $? != 0 )) && \
(( $? > 0 )) && \
warn "'${_HPSSACLI_BIN} controller slot=${_CTRL_SLOT}logicaldrive all show status' exited non-zero"
# look for failures
grep -i -E -e "(nok|fail)" ${_TMP_FILE} 2>/dev/null |\

View File

@ -41,7 +41,7 @@ typeset _SUPPORTED_PLATFORMS="Linux" # uname -s match
# ------------------------- CONFIGURATION ends here ---------------------------
# set defaults
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*")
typeset _ARG=""
@ -90,7 +90,7 @@ case "${LINUX_INIT}" in
esac
# 2) try the pgrep way (note: old pgreps do not support '-c')
if (( _RC != 0 ))
if (( _RC > 0 ))
then
(( $(pgrep -u root httpd 2>>${HC_STDERR_LOG} | wc -l 2>/dev/null) == 0 )) && _STC=1
fi

View File

@ -38,7 +38,7 @@ typeset _SUPPORTED_PLATFORMS="Linux" # uname -s match
# ------------------------- CONFIGURATION ends here ---------------------------
# set defaults
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*")
typeset _ARG=""
@ -101,7 +101,7 @@ case "${LINUX_INIT}" in
esac
# 2) try the pgrep way (note: old pgreps do not support '-c')
if (( _RC != 0 ))
if (( _RC > 0 ))
then
(( $(pgrep -u root named 2>>${HC_STDERR_LOG} | wc -l 2>/dev/null) == 0 )) && _STC=1
fi

View File

@ -47,7 +47,7 @@ typeset _NTPQ_BIN="/usr/sbin/ntpq"
# ------------------------- CONFIGURATION ends here ---------------------------
# set defaults
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*")
typeset _ARG=""
@ -123,7 +123,7 @@ else
_MSG="unable to find chronyd or ntpd"
log_hc "$0" 1 "${_MSG}"
# dump debug info
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && dump_logs
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && dump_logs
return 1
fi
@ -177,7 +177,7 @@ case "${LINUX_INIT}" in
esac
# 2) try the pgrep way (note: old pgreps do not support '-c')
if (( _RC != 0 ))
if (( _RC > 0 ))
then
if (( _USE_CHRONYD > 0 ))
then
@ -227,7 +227,7 @@ then
_MSG="unable to execute {${_CHRONYC_BIN}}"
log_hc "$0" 1 "${_MSG}"
# dump debug info
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && dump_logs
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && dump_logs
return 1
fi

View File

@ -41,7 +41,7 @@ typeset _SUPPORTED_PLATFORMS="Linux" # uname -s match
# ------------------------- CONFIGURATION ends here ---------------------------
# set defaults
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*")
typeset _ARG=""
@ -89,7 +89,7 @@ case "${LINUX_INIT}" in
esac
# 2) try the postfix way
if (( _RC != 0 ))
if (( _RC > 0 ))
then
_POSTFIX_BIN="$(which postfix 2>>${HC_STDERR_LOG})"
if [[ -x ${_POSTFIX_BIN} && -n "${_POSTFIX_BIN}" ]]

View File

@ -39,7 +39,7 @@ typeset _SUPPORTED_PLATFORMS="Linux" # uname -s match
# ------------------------- CONFIGURATION ends here ---------------------------
# set defaults
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*")
typeset _ARG=""
@ -146,7 +146,7 @@ do
case "${_PROCESS_LIMIT}" in
"Max open files")
# collect ps info
(( ARG_DEBUG != 0 )) && debug "${_PROCESS_LIMIT}: collecting information for process class ${_PROCESS}"
(( ARG_DEBUG > 0 )) && debug "${_PROCESS_LIMIT}: collecting information for process class ${_PROCESS}"
_PROCESS_PS=$(_get_psinfo_by_process "${_PROCESS}")
if [[ -z "${_PROCESS_PS}" ]]
then
@ -155,7 +155,7 @@ do
fi
print "${_PROCESS_PS}" | while read _PROCESS_PS_PID _PROCESS_PS_USER
do
(( ARG_DEBUG != 0 )) && debug "${_PROCESS_LIMIT}: checking process ${_PROCESS_PS_PID}"
(( ARG_DEBUG > 0 )) && debug "${_PROCESS_LIMIT}: checking process ${_PROCESS_PS_PID}"
# get current values and check thresholds
_MAX_OPEN_FILES=$(_get_open_files ${_PROCESS_PS_PID})
# SOFT limit
@ -210,7 +210,7 @@ do
case "${_USER_LIMIT}" in
"Max open files")
# collect ps info
(( ARG_DEBUG != 0 )) && debug "${_USER_LIMIT}: collecting information for user ${_USER}"
(( ARG_DEBUG > 0 )) && debug "${_USER_LIMIT}: collecting information for user ${_USER}"
_USER_PS=$(_get_psinfo_by_user "${_USER}")
if [[ -z "${_USER_PS}" ]]
then
@ -219,7 +219,7 @@ do
fi
print "${_USER_PS}" | while read _USER_PS_PID _USER_PS_COMM
do
(( ARG_DEBUG != 0 )) && debug "${_USER_LIMIT}: checking process ${_USER_PS_PID}"
(( ARG_DEBUG > 0 )) && debug "${_USER_LIMIT}: checking process ${_USER_PS_PID}"
# get current values and check thresholds
_MAX_OPEN_FILES=$(_get_open_files ${_USER_PS_PID})
# SOFT limit
@ -231,7 +231,7 @@ do
done
;;
"Max processes")
(( ARG_DEBUG != 0 )) && debug "${_USER_LIMIT}: collecting information for user ${_USER}"
(( ARG_DEBUG > 0 )) && debug "${_USER_LIMIT}: collecting information for user ${_USER}"
_MAX_PROCESSES=$(_get_processes ${_USER})
# SOFT limit
_check_limit "${_USER_LIMIT}" soft 0 ${_USER} "" ${_USER_SOFT_THRESHOLD} \
@ -259,7 +259,7 @@ return 0
#1992 root
function _get_psinfo_by_process
{
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
ps -C "${1}" -o pid:1,user:1 --no-headers 2>/dev/null
@ -272,7 +272,7 @@ return 0
#8539 pickup
function _get_psinfo_by_user
{
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
ps -U "${1}" -o pid:1,comm:1 --no-headers 2>/dev/null
@ -293,7 +293,7 @@ typeset _LIMIT_COMMAND=""
typeset _LIMIT_ENTRY=""
typeset _LIMIT_FIELD=0
typeset _MSG_BIT=""
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
# check for empties
(( _LIMIT_PID == 0 )) && _LIMIT_PID="N/A"
@ -370,7 +370,7 @@ return 0
# -----------------------------------------------------------------------------
function _get_open_files
{
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
ls -f /proc/${1}/fd/ 2>/dev/null | wc -l 2>/dev/null
@ -380,7 +380,7 @@ return 0
# -----------------------------------------------------------------------------
function _get_processes
{
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
ps -U ${1} --no-headers 2>/dev/null | wc -l 2>/dev/null

View File

@ -38,7 +38,7 @@ typeset _SUPPORTED_PLATFORMS="Linux" # uname -s match
# ------------------------- CONFIGURATION ends here ---------------------------
# set defaults
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*")
typeset _ARG=""

View File

@ -43,7 +43,7 @@ typeset _SUPPORTED_PLATFORMS="Linux" # uname -s match
# ------------------------- CONFIGURATION ends here ---------------------------
# set defaults
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*")
typeset _ARG=""
@ -98,7 +98,7 @@ case "${LINUX_INIT}" in
esac
# 2) try the pgrep way (note: old pgreps do not support '-c')
if (( _RC != 0 ))
if (( _RC > 0 ))
then
(( $(pgrep -u root nmbd 2>>${HC_STDERR_LOG}| wc -l 2>/dev/null) == 0 )) && _STC=1
(( $(pgrep -u root smbd 2>>${HC_STDERR_LOG} | wc -l 2>/dev/null) == 0 )) && _STC=$(( _STC + 2 ))

View File

@ -42,7 +42,7 @@ typeset _SG_CMGETCONF_FILTER="Permission denied|Number of configured"
# ------------------------- CONFIGURATION ends here ---------------------------
# set defaults
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
PATH=$PATH:/opt/cmcluster/bin
init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*")
@ -109,7 +109,7 @@ else
_MSG="unable to gather cluster configuration"
log_hc "$0" 1 "${_MSG}"
# dump debug info
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && dump_logs
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && dump_logs
return 0
}
done

View File

@ -42,7 +42,7 @@ typeset _SG_DAEMON="/opt/cmcluster/bin/cmcld"
# ------------------------- CONFIGURATION ends here ---------------------------
# set defaults
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
PATH=$PATH:/opt/cmcluster/bin
init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*")
@ -80,11 +80,11 @@ then
return 1
else
cmviewcl -v -f line 2>>${HC_STDERR_LOG} | tr '|' ':' >>${HC_STDOUT_LOG} 2>/dev/null
(( $? != 0 )) && {
(( $? > 0 )) && {
_MSG="unable to run command: {cmviewcl}"
log_hc "$0" 1 "${_MSG}"
# dump debug info
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && dump_logs
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && dump_logs
return 0
}
fi

View File

@ -42,7 +42,7 @@ typeset _SG_CMGETCONF_FILTER="Permission denied|Number of configured"
# ------------------------- CONFIGURATION ends here ---------------------------
# set defaults
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
PATH=$PATH:/opt/cmcluster/bin
init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*")
@ -109,7 +109,7 @@ else
_MSG="unable to gather package configuration for at least one cluster package"
log_hc "$0" 1 "${_MSG}"
# dump debug info
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && dump_logs
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && dump_logs
return 0
}
done

View File

@ -42,7 +42,7 @@ typeset _SG_DAEMON="/opt/cmcluster/bin/cmcld"
# ------------------------- CONFIGURATION ends here ---------------------------
# set defaults
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
PATH=$PATH:/opt/cmcluster/bin
init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*")
@ -81,11 +81,11 @@ then
return 1
else
cmviewcl -v -f line -l package 2>>${HC_STDERR_LOG} | tr '|' ':' >>${HC_STDOUT_LOG}
(( $? != 0)) && {
(( $? > 0)) && {
_MSG="unable to run command: {cmviewcl}"
log_hc "$0" 1 "${_MSG}"
# dump debug info
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && dump_logs
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && dump_logs
return 0
}
fi

View File

@ -39,7 +39,7 @@ typeset _QS_AUTH_FILE="/opt/qs/conf/qs_authfile"
# ------------------------- CONFIGURATION ends here ---------------------------
# set defaults
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*")
typeset _ARG=""

View File

@ -37,7 +37,7 @@ typeset _SUPPORTED_PLATFORMS="Linux" # uname -s match
# ------------------------- CONFIGURATION ends here ---------------------------
# set defaults
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*")
typeset _ARG=""

View File

@ -39,7 +39,7 @@ typeset _SUPPORTED_PLATFORMS="Linux" # uname -s match
# ------------------------- CONFIGURATION ends here ---------------------------
# set defaults
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*")
typeset _ARG=""
@ -99,7 +99,7 @@ case "${LINUX_INIT}" in
esac
# 2) try the pgrep way (note: old pgreps do not support '-c')
if (( _RC != 0 ))
if (( _RC > 0 ))
then
(( $(pgrep -P 1 -u root sshd 2>>${HC_STDERR_LOG} | wc -l 2>/dev/null) == 0 )) && _STC=1
fi

View File

@ -44,7 +44,7 @@ typeset _SUPPORTED_PLATFORMS="Linux" # uname -s match
# ------------------------- CONFIGURATION ends here ---------------------------
# set defaults
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*")
typeset _ARG=""
@ -80,11 +80,11 @@ fi
# get container stati
${_VZLIST_BIN} -a -H -o ctid,status,onboot >>${HC_STDOUT_LOG} 2>>${HC_STDERR_LOG}
(( $? != 0 )) && {
(( $? > 0 )) && {
_MSG="unable to run command: {vzlist}"
log_hc "$0" 1 "${_MSG}"
# dump debug info
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && dump_logs
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && dump_logs
return 0
}

View File

@ -41,7 +41,7 @@ typeset _SUPPORTED_PLATFORMS="Linux" # uname -s match
# ------------------------- CONFIGURATION ends here ---------------------------
# set defaults
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set ${DEBUG_OPTS}
init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*")
typeset _ARG=""
@ -87,7 +87,7 @@ case "${LINUX_INIT}" in
esac
# 2) try the pgrep way (note: old pgreps do not support '-c')
if (( _RC != 0 ))
if (( _RC > 0 ))
then
(( $(pgrep -u root winbind 2>>${HC_STDERR_LOG} | wc -l 2>/dev/null) == 0 )) && _STC=1
fi