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

View File

@ -36,7 +36,7 @@ typeset _DISPLAY_SEP=";"
# ------------------------- CONFIGURATION ends here --------------------------- # ------------------------- CONFIGURATION ends here ---------------------------
# set defaults # 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}" init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _DISPLAY_HC="$1" typeset _DISPLAY_HC="$1"

View File

@ -36,7 +36,7 @@ typeset _SUPPORTED_PLATFORMS="AIX,HP-UX,Linux" # uname -s match
# ------------------------- CONFIGURATION ends here --------------------------- # ------------------------- CONFIGURATION ends here ---------------------------
# set defaults # 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}" init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _DISPLAY_HC="$1" typeset _DISPLAY_HC="$1"

View File

@ -35,7 +35,7 @@ typeset _SUPPORTED_PLATFORMS="AIX,HP-UX,Linux" # uname -s match
# ------------------------- CONFIGURATION ends here --------------------------- # ------------------------- CONFIGURATION ends here ---------------------------
# set defaults # 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}" init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _DISPLAY_HC="$1" typeset _DISPLAY_HC="$1"

View File

@ -35,7 +35,7 @@ typeset _SUPPORTED_PLATFORMS="AIX,HP-UX,Linux" # uname -s match
# ------------------------- CONFIGURATION ends here --------------------------- # ------------------------- CONFIGURATION ends here ---------------------------
# set defaults # 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}" init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _DISPLAY_HC="$1" typeset _DISPLAY_HC="$1"

View File

@ -37,7 +37,7 @@ typeset _SUPPORTED_PLATFORMS="AIX,HP-UX,Linux" # uname -s match
# ------------------------- CONFIGURATION ends here --------------------------- # ------------------------- CONFIGURATION ends here ---------------------------
# set defaults # 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}" init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _DISPLAY_HC="$1" typeset _DISPLAY_HC="$1"

View File

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

View File

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

View File

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

View File

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

View File

@ -35,7 +35,7 @@ typeset _SUPPORTED_PLATFORMS="AIX,HP-UX,Linux" # uname -s match
# ------------------------- CONFIGURATION ends here --------------------------- # ------------------------- CONFIGURATION ends here ---------------------------
# set defaults # 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}" init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _MAIL_HC="$1" typeset _MAIL_HC="$1"

View File

@ -36,7 +36,7 @@ typeset _SUPPORTED_PLATFORMS="AIX,HP-UX,Linux" # uname -s match
# ------------------------- CONFIGURATION ends here --------------------------- # ------------------------- CONFIGURATION ends here ---------------------------
# set defaults # 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}" init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _SMS_HC="$1" typeset _SMS_HC="$1"

View File

@ -35,7 +35,7 @@ typeset _SUPPORTED_PLATFORMS="AIX,HP-UX,Linux" # uname -s match
# ------------------------- CONFIGURATION ends here --------------------------- # ------------------------- CONFIGURATION ends here ---------------------------
# set defaults # 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}" init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _DIR_PREFIX="" typeset _DIR_PREFIX=""
@ -52,7 +52,7 @@ typeset _LOG_STASH=""
typeset _SORT_CMD="" typeset _SORT_CMD=""
# which files do we need to examine # which files do we need to examine
if (( ARG_HISTORY != 0 )) if (( ARG_HISTORY > 0 ))
then then
set +f # file globbing must be on set +f # file globbing must be on
_LOG_STASH="${HC_LOG} ${ARCHIVE_DIR}/hc.*.log" _LOG_STASH="${HC_LOG} ${ARCHIVE_DIR}/hc.*.log"
@ -61,7 +61,7 @@ else
fi fi
# --last report # --last report
if (( ARG_LAST != 0 )) if (( ARG_LAST > 0 ))
then then
printf "\n| %-30s | %-20s | %-14s | %-4s\n" "HC" "Timestamp" "FAIL ID" "STC (combined value)" printf "\n| %-30s | %-20s | %-14s | %-4s\n" "HC" "Timestamp" "FAIL ID" "STC (combined value)"
# shellcheck disable=SC2183 # shellcheck disable=SC2183
@ -113,14 +113,14 @@ then
else else
_ID_NEEDLE="[0-9][0-9]*" _ID_NEEDLE="[0-9][0-9]*"
[[ -n "${ARG_FAIL_ID}" ]] && _ID_NEEDLE="${ARG_FAIL_ID}" [[ -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) # 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) _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 then
# check for detail or not? # check for detail or not?
if (( ARG_DETAIL != 0 )) && (( _FAIL_COUNT != 1 )) if (( ARG_DETAIL > 0 )) && (( _FAIL_COUNT > 1 ))
then then
ARG_LOG=1 die "you must specify a unique FAIL_ID value" ARG_LOG=1 die "you must specify a unique FAIL_ID value"
fi fi

View File

@ -39,7 +39,7 @@ typeset _SUPPORTED_PLATFORMS="AIX" # uname -s match
# ------------------------- CONFIGURATION ends here --------------------------- # ------------------------- CONFIGURATION ends here ---------------------------
# set defaults # 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}" init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*") typeset _ARGS=$(data_space2comma "$*")
typeset _ARG="" typeset _ARG=""

View File

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

View File

@ -39,7 +39,7 @@ typeset _SUPPORTED_PLATFORMS="Linux" # uname -s match
# ------------------------- CONFIGURATION ends here --------------------------- # ------------------------- CONFIGURATION ends here ---------------------------
# set defaults # 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}" init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*") typeset _ARGS=$(data_space2comma "$*")
typeset _ARG="" typeset _ARG=""
@ -297,7 +297,7 @@ do
fi fi
# bounce failures back and jump to next file # bounce failures back and jump to next file
if (( _STC != 0 )) if (( _STC > 0 ))
then then
log_hc "$0" ${_STC} "${_MSG}" log_hc "$0" ${_STC} "${_MSG}"
continue continue
@ -327,7 +327,7 @@ do
done <${_TMP1_FILE} done <${_TMP1_FILE}
# update state file (also if TMP2_FILE is empty) # update state file (also if TMP2_FILE is empty)
if (( ARG_LOG != 0 )) if (( ARG_LOG > 0 ))
then then
[[ -s ${_TMP2_FILE} ]] || { [[ -s ${_TMP2_FILE} ]] || {
warn "no files found to check, zeroing new state 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 --------------------------- # ------------------------- CONFIGURATION ends here ---------------------------
# set defaults # 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}" init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*") typeset _ARGS=$(data_space2comma "$*")
typeset _ARG="" typeset _ARG=""
@ -51,7 +51,7 @@ do
case "${_ARG}" in case "${_ARG}" in
help) help)
_show_usage $0 ${_VERSION} ${_CONFIG_FILE} && return 0 _show_usage $0 ${_VERSION} ${_CONFIG_FILE} && return 0
;; ;;
esac esac
done done
@ -79,9 +79,9 @@ do
;; ;;
*) *)
_MSG="${_FS} is multiple times mounted?" _MSG="${_FS} is multiple times mounted?"
;; ;;
esac esac
# handle unit result # handle unit result
log_hc "$0" ${_STC} "${_MSG}" log_hc "$0" ${_STC} "${_MSG}"
_STC=0 _STC=0

View File

@ -36,7 +36,7 @@ typeset _SUPPORTED_PLATFORMS="AIX" # uname -s match
# ------------------------- CONFIGURATION ends here --------------------------- # ------------------------- CONFIGURATION ends here ---------------------------
# set defaults # 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}" init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*") typeset _ARGS=$(data_space2comma "$*")
typeset _ARG="" typeset _ARG=""
@ -49,7 +49,7 @@ do
case "${_ARG}" in case "${_ARG}" in
help) help)
_show_usage $0 ${_VERSION} ${_CONFIG_FILE} && return 0 _show_usage $0 ${_VERSION} ${_CONFIG_FILE} && return 0
;; ;;
esac esac
done done

View File

@ -36,7 +36,7 @@ typeset _SUPPORTED_PLATFORMS="AIX" # uname -s match
# ------------------------- CONFIGURATION ends here --------------------------- # ------------------------- CONFIGURATION ends here ---------------------------
# set defaults # 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}" init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*") typeset _ARGS=$(data_space2comma "$*")
typeset _ARG="" typeset _ARG=""
@ -50,7 +50,7 @@ do
case "${_ARG}" in case "${_ARG}" in
help) help)
_show_usage $0 ${_VERSION} ${_CONFIG_FILE} && return 0 _show_usage $0 ${_VERSION} ${_CONFIG_FILE} && return 0
;; ;;
esac esac
done done
@ -69,7 +69,7 @@ case ${_PATH} in
_STC=1 _STC=1
;; ;;
esac esac
# handle results # handle results
log_hc "$0" ${_STC} "${_MSG}" log_hc "$0" ${_STC} "${_MSG}"

View File

@ -37,7 +37,7 @@ typeset _SUPPORTED_PLATFORMS="AIX" # uname -s match
# ------------------------- CONFIGURATION ends here --------------------------- # ------------------------- CONFIGURATION ends here ---------------------------
# set defaults # 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}" init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*") typeset _ARGS=$(data_space2comma "$*")
typeset _ARG="" typeset _ARG=""
@ -52,14 +52,14 @@ do
case "${_ARG}" in case "${_ARG}" in
help) help)
_show_usage $0 ${_VERSION} ${_CONFIG_FILE} && return 0 _show_usage $0 ${_VERSION} ${_CONFIG_FILE} && return 0
;; ;;
esac esac
done done
# handle configuration file # handle configuration file
[[ -n "${ARG_CONFIG_FILE}" ]] && _CONFIG_FILE="${ARG_CONFIG_FILE}" [[ -n "${ARG_CONFIG_FILE}" ]] && _CONFIG_FILE="${ARG_CONFIG_FILE}"
if [[ ! -r ${_CONFIG_FILE} ]] if [[ ! -r ${_CONFIG_FILE} ]]
then then
warn "unable to read configuration file at ${_CONFIG_FILE}" warn "unable to read configuration file at ${_CONFIG_FILE}"
return 1 return 1
@ -77,15 +77,15 @@ do
0) 0)
_MSG="'${_CRON_ENTRY}' is not configured in cron" _MSG="'${_CRON_ENTRY}' is not configured in cron"
_STC=1 _STC=1
;; ;;
1) 1)
_MSG="'${_CRON_ENTRY}' is configured in cron" _MSG="'${_CRON_ENTRY}' is configured in cron"
;; ;;
+([0-9])*([0-9])) +([0-9])*([0-9]))
_MSG="'${_CRON_ENTRY}' is configured multiple times in cron" _MSG="'${_CRON_ENTRY}' is configured multiple times in cron"
;; ;;
esac esac
# handle unit result # handle unit result
log_hc "$0" ${_STC} "${_MSG}" log_hc "$0" ${_STC} "${_MSG}"
_STC=0 _STC=0

View File

@ -37,7 +37,7 @@ typeset _SUPPORTED_PLATFORMS="AIX" # uname -s match
# ------------------------- CONFIGURATION ends here --------------------------- # ------------------------- CONFIGURATION ends here ---------------------------
# set defaults # 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}" init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*") typeset _ARGS=$(data_space2comma "$*")
typeset _ARG="" typeset _ARG=""
@ -51,14 +51,14 @@ do
case "${_ARG}" in case "${_ARG}" in
help) help)
_show_usage $0 ${_VERSION} ${_CONFIG_FILE} && return 0 _show_usage $0 ${_VERSION} ${_CONFIG_FILE} && return 0
;; ;;
esac esac
done done
# handle configuration file # handle configuration file
[[ -n "${ARG_CONFIG_FILE}" ]] && _CONFIG_FILE="${ARG_CONFIG_FILE}" [[ -n "${ARG_CONFIG_FILE}" ]] && _CONFIG_FILE="${ARG_CONFIG_FILE}"
if [[ ! -r ${_CONFIG_FILE} ]] if [[ ! -r ${_CONFIG_FILE} ]]
then then
warn "unable to read configuration file at ${_CONFIG_FILE}" warn "unable to read configuration file at ${_CONFIG_FILE}"
return 1 return 1
@ -82,9 +82,9 @@ do
;; ;;
*) *)
_MSG="${_SUBSYS} is not on file" _MSG="${_SUBSYS} is not on file"
;; ;;
esac esac
# handle unit result # handle unit result
log_hc "$0" ${_STC} "${_MSG}" log_hc "$0" ${_STC} "${_MSG}"
_STC=0 _STC=0

View File

@ -17,7 +17,7 @@
# DOCUMENTATION (MAIN) # DOCUMENTATION (MAIN)
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# @(#) MAIN: check_aix_sysbackup # @(#) MAIN: check_aix_sysbackup
# DOES: see _show_usage() # DOES: see _show_usage()
# EXPECTS: see _show_usage() # EXPECTS: see _show_usage()
# REQUIRES: data_space2comma(), init_hc(), log_hc() # REQUIRES: data_space2comma(), init_hc(), log_hc()
# #
@ -39,7 +39,7 @@ typeset _SUPPORTED_PLATFORMS="AIX" # uname -s match
# ------------------------- CONFIGURATION ends here --------------------------- # ------------------------- CONFIGURATION ends here ---------------------------
# set defaults # 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}" init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*") typeset _ARGS=$(data_space2comma "$*")
typeset _ARG="" typeset _ARG=""
@ -59,13 +59,13 @@ do
case "${_ARG}" in case "${_ARG}" in
help) help)
_show_usage $0 ${_VERSION} ${_CONFIG_FILE} && return 0 _show_usage $0 ${_VERSION} ${_CONFIG_FILE} && return 0
;; ;;
esac esac
done done
# handle configuration file # handle configuration file
[[ -n "${ARG_CONFIG_FILE}" ]] && _CONFIG_FILE="${ARG_CONFIG_FILE}" [[ -n "${ARG_CONFIG_FILE}" ]] && _CONFIG_FILE="${ARG_CONFIG_FILE}"
if [[ ! -r ${_CONFIG_FILE} ]] if [[ ! -r ${_CONFIG_FILE} ]]
then then
warn "unable to read configuration file at ${_CONFIG_FILE}" warn "unable to read configuration file at ${_CONFIG_FILE}"
return 1 return 1
@ -93,7 +93,7 @@ case "${_BACKUP_AGE}" in
+([0-9])*(.)*([0-9])) +([0-9])*(.)*([0-9]))
# numeric, OK # numeric, OK
;; ;;
*) *)
# not numeric, set default # not numeric, set default
_BACKUP_AGE=14 _BACKUP_AGE=14
;; ;;
@ -118,21 +118,21 @@ do
# save log # save log
print "=== ${_BACKUP_HOST} ===" >>${HC_STDOUT_LOG} print "=== ${_BACKUP_HOST} ===" >>${HC_STDOUT_LOG}
cat ${_BACKUP_LOG} >>${HC_STDOUT_LOG} cat ${_BACKUP_LOG} >>${HC_STDOUT_LOG}
;; ;;
*) *)
_MSG="sysbackup status for ${_BACKUP_HOST}: failed" _MSG="sysbackup status for ${_BACKUP_HOST}: failed"
_STC=1 _STC=1
print "=== ${_BACKUP_HOST} ===" >>${HC_STDOUT_LOG} print "=== ${_BACKUP_HOST} ===" >>${HC_STDOUT_LOG}
cat ${_BACKUP_LOG} >>${HC_STDOUT_LOG} cat ${_BACKUP_LOG} >>${HC_STDOUT_LOG}
;; ;;
esac esac
else else
# don't flag this as erroneous, we could drop into this fork for # don't flag this as erroneous, we could drop into this fork for
# VIO servers for example without mksysb but having backupios instead # VIO servers for example without mksysb but having backupios instead
# caveat emptor: also means that hosts *without* backup go undetected # caveat emptor: also means that hosts *without* backup go undetected
continue continue
fi fi
# handle unit result # handle unit result
log_hc "$0" ${_STC} "${_MSG}" log_hc "$0" ${_STC} "${_MSG}"
_STC=0 _STC=0
@ -148,25 +148,25 @@ do
if (( _COUNT == 0 )) if (( _COUNT == 0 ))
then then
_MSG="sysbackup age for ${_BACKUP_HOST}: <=${_BACKUP_AGE} days" _MSG="sysbackup age for ${_BACKUP_HOST}: <=${_BACKUP_AGE} days"
_STC=0 _STC=0
else else
_MSG="sysbackup age for ${_BACKUP_HOST}: >${_BACKUP_AGE} days" _MSG="sysbackup age for ${_BACKUP_HOST}: >${_BACKUP_AGE} days"
_STC=1 _STC=1
print "=== ${_BACKUP_HOST} ===" >>${HC_STDOUT_LOG} print "=== ${_BACKUP_HOST} ===" >>${HC_STDOUT_LOG}
print "age: $(ls -l ${_BACKUP_LOG})" >>${HC_STDOUT_LOG} print "age: $(ls -l ${_BACKUP_LOG})" >>${HC_STDOUT_LOG}
fi fi
else else
# don't flag this as erroneous, we could drop into this fork for # don't flag this as erroneous, we could drop into this fork for
# VIO servers for example without mksysb but having backupios instead # VIO servers for example without mksysb but having backupios instead
# caveat emptor: also means that hosts *without* backup go undetected # caveat emptor: also means that hosts *without* backup go undetected
continue continue
fi fi
# handle unit result # handle unit result
log_hc "$0" ${_STC} "${_MSG}" log_hc "$0" ${_STC} "${_MSG}"
_STC=0 _STC=0
done done
return 0 return 0
} }
@ -180,9 +180,9 @@ CONFIG : $3 with:
backup_path=<location_of_mksysb_images> backup_path=<location_of_mksysb_images>
mksysb_log=<name_of_standard_standard_mksysb_log> mksysb_log=<name_of_standard_standard_mksysb_log>
backup_age=<days_till_last_backup> backup_age=<days_till_last_backup>
PURPOSE : Checks the state of saved mksysb client backups (should typically be PURPOSE : Checks the state of saved mksysb client backups (should typically be
run only on the NIM master or server that is acting as mksysb repo, run only on the NIM master or server that is acting as mksysb repo,
do NOT run on a typical client LPAR) do NOT run on a typical client LPAR)
EOT EOT

View File

@ -37,7 +37,7 @@ typeset _SUPPORTED_PLATFORMS="AIX" # uname -s match
# ------------------------- CONFIGURATION ends here --------------------------- # ------------------------- CONFIGURATION ends here ---------------------------
# set defaults # 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}" init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*") typeset _ARGS=$(data_space2comma "$*")
typeset _ARG="" typeset _ARG=""
@ -52,7 +52,7 @@ do
case "${_ARG}" in case "${_ARG}" in
help) help)
_show_usage $0 ${_VERSION} ${_CONFIG_FILE} && return 0 _show_usage $0 ${_VERSION} ${_CONFIG_FILE} && return 0
;; ;;
esac esac
done done
@ -64,11 +64,11 @@ topasrec -l >>${HC_STDOUT_LOG} 2>>${HC_STDERR_LOG}
_TOPAS=$(grep -c "bin" ${HC_STDOUT_LOG} 2>/dev/null) _TOPAS=$(grep -c "bin" ${HC_STDOUT_LOG} 2>/dev/null)
_NMON=$(grep -c "nmon" ${HC_STDOUT_LOG} 2>/dev/null) _NMON=$(grep -c "nmon" ${HC_STDOUT_LOG} 2>/dev/null)
_MSG="process checks: nmon=${_NMON}; topasrec=${_TOPAS}" _MSG="process checks: nmon=${_NMON}; topasrec=${_TOPAS}"
if (( _NMON != 1 || _TOPAS != 1 )) if (( _NMON > 1 || _TOPAS > 1 ))
then then
_STC=1 _STC=1
fi fi
# handle results # handle results
log_hc "$0" ${_STC} "${_MSG}" log_hc "$0" ${_STC} "${_MSG}"

View File

@ -39,7 +39,7 @@ typeset _SUPPORTED_PLATFORMS="HP-UX" # uname -s match
# ------------------------- CONFIGURATION ends here --------------------------- # ------------------------- CONFIGURATION ends here ---------------------------
# set defaults # 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}" init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*") typeset _ARGS=$(data_space2comma "$*")
typeset _ARG="" typeset _ARG=""
@ -55,12 +55,12 @@ do
case "${_ARG}" in case "${_ARG}" in
help) help)
_show_usage $0 ${_VERSION} ${_CONFIG_FILE} && return 0 _show_usage $0 ${_VERSION} ${_CONFIG_FILE} && return 0
;; ;;
esac esac
done done
# check autopath presence # check autopath presence
if [[ ! -x ${_AUTOPATH_BIN} ]] if [[ ! -x ${_AUTOPATH_BIN} ]]
then then
warn "${_AUTOPATH_BIN} is not installed here" warn "${_AUTOPATH_BIN} is not installed here"
return 1 return 1
@ -69,23 +69,23 @@ fi
# collect autopath info # collect autopath info
log "collecting autopath information, this may take a while ..." log "collecting autopath information, this may take a while ..."
${_AUTOPATH_BIN} display >>${HC_STDOUT_LOG} 2>>${HC_STDERR_LOG} ${_AUTOPATH_BIN} display >>${HC_STDOUT_LOG} 2>>${HC_STDERR_LOG}
(( $? != 0 )) && { (( $? > 0 )) && {
_MSG="unable to run {${_AUTOPATH_BIN}}" _MSG="unable to run {${_AUTOPATH_BIN}}"
log_hc "$0" 1 "${_MSG}" log_hc "$0" 1 "${_MSG}"
# dump debug info # dump debug info
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && dump_logs (( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && dump_logs
return 0 return 0
} }
# check for device failures # check for device failures
grep -E -e "${_AUTOPATH_NEEDLE}" ${HC_STDOUT_LOG} 2>/dev/null |\ grep -E -e "${_AUTOPATH_NEEDLE}" ${HC_STDOUT_LOG} 2>/dev/null |\
while read _AUTOPATH_LINE while read _AUTOPATH_LINE
do do
_DEVICE="$(print ${_AUTOPATH_LINE} | cut -f1 -d' ')" _DEVICE="$(print ${_AUTOPATH_LINE} | cut -f1 -d' ')"
_MSG="failed path for device '${_DEVICE}'" _MSG="failed path for device '${_DEVICE}'"
_STC=1 _STC=1
_STC_COUNT=$(( _STC_COUNT + 1 )) _STC_COUNT=$(( _STC_COUNT + 1 ))
# handle unit result # handle unit result
log_hc "$0" ${_STC} "${_MSG}" log_hc "$0" ${_STC} "${_MSG}"
_STC=0 _STC=0

View File

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

View File

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

View File

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

View File

@ -39,7 +39,7 @@ typeset _SUPPORTED_PLATFORMS="HP-UX" # uname -s match
# ------------------------- CONFIGURATION ends here --------------------------- # ------------------------- CONFIGURATION ends here ---------------------------
# set defaults # 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}" init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*") typeset _ARGS=$(data_space2comma "$*")
typeset _ARG="" typeset _ARG=""
@ -297,7 +297,7 @@ do
fi fi
# bounce failures back and jump to next file # bounce failures back and jump to next file
if (( _STC != 0 )) if (( _STC > 0 ))
then then
log_hc "$0" ${_STC} "${_MSG}" log_hc "$0" ${_STC} "${_MSG}"
continue continue
@ -327,7 +327,7 @@ do
done <${_TMP1_FILE} done <${_TMP1_FILE}
# update state file (also if TMP2_FILE is empty) # update state file (also if TMP2_FILE is empty)
if (( ARG_LOG != 0 )) if (( ARG_LOG > 0 ))
then then
[[ -s ${_TMP2_FILE} ]] || { [[ -s ${_TMP2_FILE} ]] || {
warn "no files found to check, zeroing new state 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 --------------------------- # ------------------------- CONFIGURATION ends here ---------------------------
# set defaults # 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}" init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*") typeset _ARGS=$(data_space2comma "$*")
typeset _ARG="" typeset _ARG=""
@ -53,7 +53,7 @@ do
case "${_ARG}" in case "${_ARG}" in
help) help)
_show_usage $0 ${_VERSION} ${_CONFIG_FILE} && return 0 _show_usage $0 ${_VERSION} ${_CONFIG_FILE} && return 0
;; ;;
esac esac
done done
@ -78,16 +78,16 @@ do
;; ;;
*) *)
_MSG="${_FS} is multiple times mounted?" _MSG="${_FS} is multiple times mounted?"
;; ;;
esac esac
# handle unit result # handle unit result
log_hc "$0" ${_STC} "${_MSG}" log_hc "$0" ${_STC} "${_MSG}"
_STC=0 _STC=0
done done
# add /etc/fstab to STDOUT log # add /etc/fstab to STDOUT log
cat /etc/fstab >>${HC_STDOUT_LOG} cat /etc/fstab >>${HC_STDOUT_LOG}
return 0 return 0
} }

View File

@ -40,7 +40,7 @@ typeset _SUPPORTED_PLATFORMS="HP-UX" # uname -s match
# ------------------------- CONFIGURATION ends here --------------------------- # ------------------------- CONFIGURATION ends here ---------------------------
# set defaults # 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}" init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*") typeset _ARGS=$(data_space2comma "$*")
typeset _ARG="" typeset _ARG=""

View File

@ -37,7 +37,7 @@ typeset _SUPPORTED_PLATFORMS="HP-UX" # uname -s match
# ------------------------- CONFIGURATION ends here --------------------------- # ------------------------- CONFIGURATION ends here ---------------------------
# set defaults # 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}" init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*") typeset _ARGS=$(data_space2comma "$*")
typeset _ARG="" typeset _ARG=""
@ -74,7 +74,7 @@ else
fi fi
# 2) try the pgrep way (note: old pgreps do not support '-c') # 2) try the pgrep way (note: old pgreps do not support '-c')
if (( _RC != 0 )) if (( _RC > 0 ))
then then
# we need guidkeyd & guidd # we need guidkeyd & guidd
(( $(pgrep -P 1 -u root guidd 2>>${HC_STDERR_LOG} | wc -l) == 0 )) && _STC=1 (( $(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 --------------------------- # ------------------------- CONFIGURATION ends here ---------------------------
# set defaults # 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}" init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*") typeset _ARGS=$(data_space2comma "$*")
typeset _ARG="" typeset _ARG=""
@ -76,11 +76,11 @@ then
fi fi
${_HPVMSTATUS_BIN} -M >>${HC_STDOUT_LOG} 2>>${HC_STDERR_LOG} ${_HPVMSTATUS_BIN} -M >>${HC_STDOUT_LOG} 2>>${HC_STDERR_LOG}
(( $? != 0 )) && { (( $? > 0 )) && {
_MSG="unable to run command: {${_HPVMSTATUS_BIN}}" _MSG="unable to run command: {${_HPVMSTATUS_BIN}}"
log_hc "$0" 1 "${_MSG}" log_hc "$0" 1 "${_MSG}"
# dump debug info # dump debug info
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && dump_logs (( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && dump_logs
return 0 return 0
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -42,7 +42,7 @@ typeset _SUPPORTED_PLATFORMS="HP-UX" # uname -s match
# ------------------------- CONFIGURATION ends here --------------------------- # ------------------------- CONFIGURATION ends here ---------------------------
# set defaults # 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}" init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*") typeset _ARGS=$(data_space2comma "$*")
typeset _ARG="" typeset _ARG=""
@ -117,7 +117,7 @@ fi
} }
# get all disk LUNs # get all disk LUNs
(( ARG_DEBUG != 0 )) && debug "collecting ioscan information" (( ARG_DEBUG > 0 )) && debug "collecting ioscan information"
print "=== ioscan ===" >>${HC_STDOUT_LOG} print "=== ioscan ===" >>${HC_STDOUT_LOG}
${_IOSCAN_BIN} ${_IOSCAN_OPTS} >${_TMP1_FILE} 2>>${HC_STDERR_LOG} ${_IOSCAN_BIN} ${_IOSCAN_OPTS} >${_TMP1_FILE} 2>>${HC_STDERR_LOG}
if (( $? > 0 )) if (( $? > 0 ))
@ -125,24 +125,24 @@ then
_MSG="unable to gather ioscan information" _MSG="unable to gather ioscan information"
log_hc "$0" 1 "${_MSG}" log_hc "$0" 1 "${_MSG}"
# dump debug info # dump debug info
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && dump_logs (( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && dump_logs
return 1 return 1
fi fi
# collect scsimgr info for all LUNs # 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} ${_SCSIMGR_BIN} ${_SCSIMGR_OPTS} >${_TMP2_FILE} 2>>${HC_STDERR_LOG}
if (( $? > 0 )) if (( $? > 0 ))
then then
_MSG="unable to gather scsimgr information" _MSG="unable to gather scsimgr information"
log_hc "$0" 1 "${_MSG}" log_hc "$0" 1 "${_MSG}"
# dump debug info # dump debug info
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && dump_logs (( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && dump_logs
return 1 return 1
fi fi
# parse ioscan + scsimgr results (WWID is the glue) # 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 = ""; } 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 --------------------------- # ------------------------- CONFIGURATION ends here ---------------------------
# set defaults # 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}" init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _NAMED_CHECKCONF_BIN="" typeset _NAMED_CHECKCONF_BIN=""
typeset _NAMED_PID="" typeset _NAMED_PID=""
@ -75,7 +75,7 @@ else
fi fi
# 2) try the pgrep way (note: old pgreps do not support '-c') # 2) try the pgrep way (note: old pgreps do not support '-c')
if (( _RC != 0 )) if (( _RC > 0 ))
then then
(( $(pgrep -u root named 2>>${HC_STDERR_LOG} | wc -l) == 0 )) && _STC=1 (( $(pgrep -u root named 2>>${HC_STDERR_LOG} | wc -l) == 0 )) && _STC=1
fi fi

View File

@ -41,7 +41,7 @@ typeset _NTPQ_BIN="/usr/sbin/ntpq"
# ------------------------- CONFIGURATION ends here --------------------------- # ------------------------- CONFIGURATION ends here ---------------------------
# set defaults # 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}" init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*") typeset _ARGS=$(data_space2comma "$*")
typeset _ARG="" typeset _ARG=""

View File

@ -43,7 +43,7 @@ typeset _OVPA_BIN="/opt/perf/bin/perfstat"
# ------------------------- CONFIGURATION ends here --------------------------- # ------------------------- CONFIGURATION ends here ---------------------------
# set defaults # 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}" init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*") typeset _ARGS=$(data_space2comma "$*")
typeset _ARG="" typeset _ARG=""

View File

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

View File

@ -36,7 +36,7 @@ typeset _SUPPORTED_PLATFORMS="HP-UX" # uname -s match
# ------------------------- CONFIGURATION ends here --------------------------- # ------------------------- CONFIGURATION ends here ---------------------------
# set defaults # 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}" init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*") typeset _ARGS=$(data_space2comma "$*")
typeset _ARG="" typeset _ARG=""
@ -50,7 +50,7 @@ do
case "${_ARG}" in case "${_ARG}" in
help) help)
_show_usage $0 ${_VERSION} ${_CONFIG_FILE} && return 0 _show_usage $0 ${_VERSION} ${_CONFIG_FILE} && return 0
;; ;;
esac esac
done done

View File

@ -37,7 +37,7 @@ typeset _SUPPORTED_PLATFORMS="HP-UX" # uname -s match
# ------------------------- CONFIGURATION ends here --------------------------- # ------------------------- CONFIGURATION ends here ---------------------------
# set defaults # 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}" init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*") typeset _ARGS=$(data_space2comma "$*")
typeset _ARG="" typeset _ARG=""
@ -52,13 +52,13 @@ do
case "${_ARG}" in case "${_ARG}" in
help) help)
_show_usage $0 ${_VERSION} ${_CONFIG_FILE} && return 0 _show_usage $0 ${_VERSION} ${_CONFIG_FILE} && return 0
;; ;;
esac esac
done done
# handle configuration file # handle configuration file
[[ -n "${ARG_CONFIG_FILE}" ]] && _CONFIG_FILE="${ARG_CONFIG_FILE}" [[ -n "${ARG_CONFIG_FILE}" ]] && _CONFIG_FILE="${ARG_CONFIG_FILE}"
if [[ ! -r ${_CONFIG_FILE} ]] if [[ ! -r ${_CONFIG_FILE} ]]
then then
warn "unable to read configuration file at ${_CONFIG_FILE}" warn "unable to read configuration file at ${_CONFIG_FILE}"
return 1 return 1
@ -76,20 +76,20 @@ do
0) 0)
_MSG="'${_CRON_ENTRY}' is not configured in cron" _MSG="'${_CRON_ENTRY}' is not configured in cron"
_STC=1 _STC=1
;; ;;
1) 1)
_MSG="'${_CRON_ENTRY}' is configured in cron" _MSG="'${_CRON_ENTRY}' is configured in cron"
;; ;;
+([0-9])*([0-9])) +([0-9])*([0-9]))
_MSG="'${_CRON_ENTRY}' is configured multiple times in cron" _MSG="'${_CRON_ENTRY}' is configured multiple times in cron"
;; ;;
esac esac
# handle unit result # handle unit result
log_hc "$0" ${_STC} "${_MSG}" log_hc "$0" ${_STC} "${_MSG}"
_STC=0 _STC=0
done done
return 0 return 0
} }

View File

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

View File

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

View File

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

View File

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

View File

@ -39,7 +39,7 @@ typeset _QS_AUTH_FILE="/etc/cmcluster/qs_authfile"
# ------------------------- CONFIGURATION ends here --------------------------- # ------------------------- CONFIGURATION ends here ---------------------------
# set defaults # 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}" init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*") typeset _ARGS=$(data_space2comma "$*")
typeset _ARG="" typeset _ARG=""

View File

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

View File

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

View File

@ -36,7 +36,7 @@ typeset _SUPPORTED_PLATFORMS="HP-UX" # uname -s match
# ------------------------- CONFIGURATION ends here --------------------------- # ------------------------- CONFIGURATION ends here ---------------------------
# set defaults # 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}" init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*") typeset _ARGS=$(data_space2comma "$*")
typeset _ARG="" typeset _ARG=""
@ -52,13 +52,13 @@ do
case "${_ARG}" in case "${_ARG}" in
help) help)
_show_usage $0 ${_VERSION} ${_CONFIG_FILE} && return 0 _show_usage $0 ${_VERSION} ${_CONFIG_FILE} && return 0
;; ;;
esac esac
done done
# get list of major and minor numbers for vgs # get list of major and minor numbers for vgs
vgdisplay -F | cut -f1 -d':' | cut -f2 -d'=' | while read _VG vgdisplay -F | cut -f1 -d':' | cut -f2 -d'=' | while read _VG
do do
ls -l ${_VG}/group >>${HC_STDOUT_LOG} 2>>${HC_STDERR_LOG} ls -l ${_VG}/group >>${HC_STDOUT_LOG} 2>>${HC_STDERR_LOG}
done done
@ -70,13 +70,13 @@ then
do do
_MSG="MAJ/MIN numbers combination '${_VG_DUPE}' is not unique" _MSG="MAJ/MIN numbers combination '${_VG_DUPE}' is not unique"
_STC=1 _STC=1
# handle unit result # handle unit result
log_hc "$0" ${_STC} "${_MSG}" log_hc "$0" ${_STC} "${_MSG}"
done done
else else
_MSG="no VGs with duplicate MAJ/MIN numbers detected" _MSG="no VGs with duplicate MAJ/MIN numbers detected"
# handle unit result # handle unit result
log_hc "$0" ${_STC} "${_MSG}" log_hc "$0" ${_STC} "${_MSG}"
fi fi

View File

@ -44,7 +44,7 @@ typeset _SUPPORTED_PLATFORMS="Linux" # uname -s match
# ------------------------- CONFIGURATION ends here --------------------------- # ------------------------- CONFIGURATION ends here ---------------------------
# set defaults # 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}" init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*") typeset _ARGS=$(data_space2comma "$*")
typeset _ARG="" typeset _ARG=""
@ -101,7 +101,7 @@ fi
# burp v1 or v2? # burp v1 or v2?
_BURP_VERSION="$(${_BURP_BIN} -v 2>/dev/null)" _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 case "${_BURP_VERSION}" in
burp-2*) burp-2*)
# check for burp server # check for burp server

View File

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

View File

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

View File

@ -40,7 +40,7 @@ typeset _SUPPORTED_PLATFORMS="Linux" # uname -s match
# ------------------------- CONFIGURATION ends here --------------------------- # ------------------------- CONFIGURATION ends here ---------------------------
# set defaults # 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}" init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*") typeset _ARGS=$(data_space2comma "$*")
typeset _ARG="" typeset _ARG=""
@ -298,7 +298,7 @@ do
fi fi
# bounce failures back and jump to next file # bounce failures back and jump to next file
if (( _STC != 0 )) if (( _STC > 0 ))
then then
log_hc "$0" ${_STC} "${_MSG}" log_hc "$0" ${_STC} "${_MSG}"
continue continue
@ -328,7 +328,7 @@ do
done <${_TMP1_FILE} done <${_TMP1_FILE}
# update state file (also if TMP2_FILE is empty) # update state file (also if TMP2_FILE is empty)
if (( ARG_LOG != 0 )) if (( ARG_LOG > 0 ))
then then
[[ -s ${_TMP2_FILE} ]] || { [[ -s ${_TMP2_FILE} ]] || {
warn "no files found to check, zeroing new state 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 --------------------------- # ------------------------- CONFIGURATION ends here ---------------------------
# set defaults # 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}" init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*") typeset _ARGS=$(data_space2comma "$*")
typeset _ARG="" typeset _ARG=""
@ -55,7 +55,7 @@ do
case "${_ARG}" in case "${_ARG}" in
help) help)
_show_usage $0 ${_VERSION} ${_CONFIG_FILE} && return 0 _show_usage $0 ${_VERSION} ${_CONFIG_FILE} && return 0
;; ;;
esac esac
done done
@ -82,9 +82,9 @@ do
;; ;;
*) *)
_MSG="${_FS} is multiple times mounted?" _MSG="${_FS} is multiple times mounted?"
;; ;;
esac esac
# handle unit result # handle unit result
log_hc "$0" ${_STC} "${_MSG}" log_hc "$0" ${_STC} "${_MSG}"
_STC=0 _STC=0

View File

@ -39,7 +39,7 @@ typeset _SUPPORTED_PLATFORMS="Linux" # uname -s match
# ------------------------- CONFIGURATION ends here --------------------------- # ------------------------- CONFIGURATION ends here ---------------------------
# set defaults # 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}" init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*") typeset _ARGS=$(data_space2comma "$*")
typeset _ARG="" typeset _ARG=""
@ -133,7 +133,7 @@ esac
# check for dependencies: we need to do DO_ACU_CTRL to have the slot info for all # check for dependencies: we need to do DO_ACU_CTRL to have the slot info for all
# the other checks # the other checks
_DO_CHECK=$(( _DO_ACU_ENCL + _DO_ACU_PHYS + _DO_ACU_LOGL )) _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 then
log "switching setting 'do_acu_controller' to 1 to fetch slot info" log "switching setting 'do_acu_controller' to 1 to fetch slot info"
_DO_ACU_CTRL=1 _DO_ACU_CTRL=1
@ -148,10 +148,10 @@ fi
# --- perform checks --- # --- perform checks ---
# CONTROLLER(s) # CONTROLLER(s)
if (( _DO_ACU_CTRL != 0 )) if (( _DO_ACU_CTRL > 0 ))
then then
${_HPACUCLI_BIN} controller all show status >${_TMP_FILE} 2>${_TMP_FILE} ${_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 # look for failures
grep -i -E -e "(nok|fail.*)" ${_TMP_FILE} 2>/dev/null |\ grep -i -E -e "(nok|fail.*)" ${_TMP_FILE} 2>/dev/null |\
while read _ACU_LINE while read _ACU_LINE
@ -183,13 +183,13 @@ else
fi fi
# ENCLOSURE(s) # ENCLOSURE(s)
if (( _DO_ACU_ENCL != 0 )) if (( _DO_ACU_ENCL > 0 ))
then then
for _CTRL_SLOT in ${_SLOT_NUMS} for _CTRL_SLOT in ${_SLOT_NUMS}
do do
${_HPACUCLI_BIN} controller slot=${_CTRL_SLOT} enclosure all show \ ${_HPACUCLI_BIN} controller slot=${_CTRL_SLOT} enclosure all show \
>${_TMP_FILE} 2>${_TMP_FILE} >${_TMP_FILE} 2>${_TMP_FILE}
(( $? != 0 )) && \ (( $? > 0 )) && \
warn "'${_HPACUCLI_BIN} controller slot=${_CTRL_SLOT} enclosure all show' exited non-zero" warn "'${_HPACUCLI_BIN} controller slot=${_CTRL_SLOT} enclosure all show' exited non-zero"
# look for failures # look for failures
grep -i -E -e "(nok|fail.*)" ${_TMP_FILE} 2>/dev/null |\ grep -i -E -e "(nok|fail.*)" ${_TMP_FILE} 2>/dev/null |\
@ -208,13 +208,13 @@ else
fi fi
# PHYSICAL DRIVE(s) # PHYSICAL DRIVE(s)
if (( _DO_ACU_PHYS != 0 )) if (( _DO_ACU_PHYS > 0 ))
then then
for _CTRL_SLOT in ${_SLOT_NUMS} for _CTRL_SLOT in ${_SLOT_NUMS}
do do
${_HPACUCLI_BIN} controller slot=${_CTRL_SLOT} physicaldrive all show status \ ${_HPACUCLI_BIN} controller slot=${_CTRL_SLOT} physicaldrive all show status \
>${_TMP_FILE} 2>${_TMP_FILE} >${_TMP_FILE} 2>${_TMP_FILE}
(( $? != 0 )) && \ (( $? > 0 )) && \
warn "'${_HPACUCLI_BIN} controller slot=${_CTRL_SLOT} physicaldrive all show status' exited non-zero" warn "'${_HPACUCLI_BIN} controller slot=${_CTRL_SLOT} physicaldrive all show status' exited non-zero"
# look for failures # look for failures
grep -i -E -e "(nok|fail.*)" ${_TMP_FILE} 2>/dev/null |\ grep -i -E -e "(nok|fail.*)" ${_TMP_FILE} 2>/dev/null |\
@ -233,13 +233,13 @@ else
fi fi
# LOGICAL DRIVE(s) # LOGICAL DRIVE(s)
if (( _DO_ACU_LOGL != 0 )) if (( _DO_ACU_LOGL > 0 ))
then then
for _CTRL_SLOT in ${_SLOT_NUMS} for _CTRL_SLOT in ${_SLOT_NUMS}
do do
${_HPACUCLI_BIN} controller slot=${_CTRL_SLOT} logicaldrive all show status \ ${_HPACUCLI_BIN} controller slot=${_CTRL_SLOT} logicaldrive all show status \
>${_TMP_FILE} 2>${_TMP_FILE} >${_TMP_FILE} 2>${_TMP_FILE}
(( $? != 0 )) && \ (( $? > 0 )) && \
warn "'${_HPACUCLI_BIN} controller slot=${_CTRL_SLOT}logicaldrive all show status' exited non-zero" warn "'${_HPACUCLI_BIN} controller slot=${_CTRL_SLOT}logicaldrive all show status' exited non-zero"
# look for failures # look for failures
grep -i -E -e "(nok|fail)" ${_TMP_FILE} 2>/dev/null |\ 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 --------------------------- # ------------------------- CONFIGURATION ends here ---------------------------
# set defaults # 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}" init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*") typeset _ARGS=$(data_space2comma "$*")
typeset _ARG="" typeset _ARG=""
@ -156,10 +156,10 @@ fi
# --- perform checks --- # --- perform checks ---
# SHOW FANS # SHOW FANS
if (( _DO_ASM_FANS != 0 )) if (( _DO_ASM_FANS > 0 ))
then then
${_HPASMCLI_BIN} -s 'SHOW FANS' >${_TMP_FILE} 2>${_TMP_FILE} ${_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 # look for failures
grep -E -e '^#' ${_TMP_FILE} 2>/dev/null | grep -vi 'normal' 2>/dev/null |\ grep -E -e '^#' ${_TMP_FILE} 2>/dev/null | grep -vi 'normal' 2>/dev/null |\
while read _ASM_LINE while read _ASM_LINE
@ -177,10 +177,10 @@ else
fi fi
# SHOW DIMM # SHOW DIMM
if (( _DO_ASM_DIMM != 0 )) if (( _DO_ASM_DIMM > 0 ))
then then
${_HPASMCLI_BIN} -s 'SHOW DIMM' >${_TMP_FILE} 2>${_TMP_FILE} ${_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 # look for failures
grep -i -E -e "(nok|fail)" ${_TMP_FILE} 2>/dev/null |\ grep -i -E -e "(nok|fail)" ${_TMP_FILE} 2>/dev/null |\
while read _ASM_LINE while read _ASM_LINE
@ -197,10 +197,10 @@ else
fi fi
# SHOW POWERSUPPLY # SHOW POWERSUPPLY
if (( _DO_ASM_POWR != 0 )) if (( _DO_ASM_POWR > 0 ))
then then
${_HPASMCLI_BIN} -s 'SHOW POWERSUPPLY' >${_TMP_FILE} 2>${_TMP_FILE} ${_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 # look for failures
grep -i -E -e "(nok|fail)" ${_TMP_FILE} 2>/dev/null |\ grep -i -E -e "(nok|fail)" ${_TMP_FILE} 2>/dev/null |\
while read _ASM_LINE while read _ASM_LINE
@ -217,10 +217,10 @@ else
fi fi
# SHOW SERVER # SHOW SERVER
if (( _DO_ASM_SRVR != 0 )) if (( _DO_ASM_SRVR > 0 ))
then then
${_HPASMCLI_BIN} -s 'SHOW SERVER' >${_TMP_FILE} 2>${_TMP_FILE} ${_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 # look for failures
grep -i -E -e "(nok|fail)" ${_TMP_FILE} 2>/dev/null |\ grep -i -E -e "(nok|fail)" ${_TMP_FILE} 2>/dev/null |\
while read _ASM_LINE while read _ASM_LINE
@ -237,10 +237,10 @@ else
fi fi
# SHOW TEMP # SHOW TEMP
if (( _DO_ASM_TEMP != 0 )) if (( _DO_ASM_TEMP > 0 ))
then then
${_HPASMCLI_BIN} -s 'SHOW TEMP' >${_TMP_FILE} 2>${_TMP_FILE} ${_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 # look for failures
grep -E -e '^#' ${_TMP_FILE} 2>/dev/null |\ grep -E -e '^#' ${_TMP_FILE} 2>/dev/null |\
while read _ASM_LINE while read _ASM_LINE

View File

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

View File

@ -39,7 +39,7 @@ typeset _SUPPORTED_PLATFORMS="Linux" # uname -s match
# ------------------------- CONFIGURATION ends here --------------------------- # ------------------------- CONFIGURATION ends here ---------------------------
# set defaults # 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}" init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*") typeset _ARGS=$(data_space2comma "$*")
typeset _ARG="" typeset _ARG=""
@ -133,7 +133,7 @@ esac
# check for dependencies: we need to do DO_SSA_CTRL to have the slot info for all # check for dependencies: we need to do DO_SSA_CTRL to have the slot info for all
# the other checks # the other checks
_DO_CHECK=$(( _DO_SSA_ENCL + _DO_SSA_PHYS + _DO_SSA_LOGL )) _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 then
log "switching setting 'do_ssa_controller' to 1 to fetch slot info" log "switching setting 'do_ssa_controller' to 1 to fetch slot info"
_DO_SSA_CTRL=1 _DO_SSA_CTRL=1
@ -148,10 +148,10 @@ fi
# --- perform checks --- # --- perform checks ---
# CONTROLLER(s) # CONTROLLER(s)
if (( _DO_SSA_CTRL != 0 )) if (( _DO_SSA_CTRL > 0 ))
then then
${_HPSSACLI_BIN} controller all show status >${_TMP_FILE} 2>${_TMP_FILE} ${_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 # look for failures
grep -i -E -e "(nok|fail.*)" ${_TMP_FILE} 2>/dev/null |\ grep -i -E -e "(nok|fail.*)" ${_TMP_FILE} 2>/dev/null |\
while read _SSA_LINE while read _SSA_LINE
@ -183,13 +183,13 @@ else
fi fi
# ENCLOSURE(s) # ENCLOSURE(s)
if (( _DO_SSA_ENCL != 0 )) if (( _DO_SSA_ENCL > 0 ))
then then
for _CTRL_SLOT in ${_SLOT_NUMS} for _CTRL_SLOT in ${_SLOT_NUMS}
do do
${_HPSSACLI_BIN} controller slot=${_CTRL_SLOT} enclosure all show \ ${_HPSSACLI_BIN} controller slot=${_CTRL_SLOT} enclosure all show \
>${_TMP_FILE} 2>${_TMP_FILE} >${_TMP_FILE} 2>${_TMP_FILE}
(( $? != 0 )) && \ (( $? > 0 )) && \
warn "'${_HPSSACLI_BIN} controller slot=${_CTRL_SLOT} enclosure all show' exited non-zero" warn "'${_HPSSACLI_BIN} controller slot=${_CTRL_SLOT} enclosure all show' exited non-zero"
# look for failures # look for failures
grep -i -E -e "(nok|fail.*)" ${_TMP_FILE} 2>/dev/null |\ grep -i -E -e "(nok|fail.*)" ${_TMP_FILE} 2>/dev/null |\
@ -208,13 +208,13 @@ else
fi fi
# PHYSICAL DRIVE(s) # PHYSICAL DRIVE(s)
if (( _DO_SSA_PHYS != 0 )) if (( _DO_SSA_PHYS > 0 ))
then then
for _CTRL_SLOT in ${_SLOT_NUMS} for _CTRL_SLOT in ${_SLOT_NUMS}
do do
${_HPSSACLI_BIN} controller slot=${_CTRL_SLOT} physicaldrive all show status \ ${_HPSSACLI_BIN} controller slot=${_CTRL_SLOT} physicaldrive all show status \
>${_TMP_FILE} 2>${_TMP_FILE} >${_TMP_FILE} 2>${_TMP_FILE}
(( $? != 0 )) && \ (( $? > 0 )) && \
warn "'${_HPSSACLI_BIN} controller slot=${_CTRL_SLOT} physicaldrive all show status' exited non-zero" warn "'${_HPSSACLI_BIN} controller slot=${_CTRL_SLOT} physicaldrive all show status' exited non-zero"
# look for failures # look for failures
grep -i -E -e "(nok|fail.*)" ${_TMP_FILE} 2>/dev/null |\ grep -i -E -e "(nok|fail.*)" ${_TMP_FILE} 2>/dev/null |\
@ -233,13 +233,13 @@ else
fi fi
# LOGICAL DRIVE(s) # LOGICAL DRIVE(s)
if (( _DO_SSA_LOGL != 0 )) if (( _DO_SSA_LOGL > 0 ))
then then
for _CTRL_SLOT in ${_SLOT_NUMS} for _CTRL_SLOT in ${_SLOT_NUMS}
do do
${_HPSSACLI_BIN} controller slot=${_CTRL_SLOT} logicaldrive all show status \ ${_HPSSACLI_BIN} controller slot=${_CTRL_SLOT} logicaldrive all show status \
>${_TMP_FILE} 2>${_TMP_FILE} >${_TMP_FILE} 2>${_TMP_FILE}
(( $? != 0 )) && \ (( $? > 0 )) && \
warn "'${_HPSSACLI_BIN} controller slot=${_CTRL_SLOT}logicaldrive all show status' exited non-zero" warn "'${_HPSSACLI_BIN} controller slot=${_CTRL_SLOT}logicaldrive all show status' exited non-zero"
# look for failures # look for failures
grep -i -E -e "(nok|fail)" ${_TMP_FILE} 2>/dev/null |\ 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 --------------------------- # ------------------------- CONFIGURATION ends here ---------------------------
# set defaults # 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}" init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*") typeset _ARGS=$(data_space2comma "$*")
typeset _ARG="" typeset _ARG=""
@ -56,7 +56,7 @@ do
case "${_ARG}" in case "${_ARG}" in
help) help)
_show_usage $0 ${_VERSION} ${_CONFIG_FILE} && return 0 _show_usage $0 ${_VERSION} ${_CONFIG_FILE} && return 0
;; ;;
esac esac
done done
@ -90,7 +90,7 @@ case "${LINUX_INIT}" in
esac esac
# 2) try the pgrep way (note: old pgreps do not support '-c') # 2) try the pgrep way (note: old pgreps do not support '-c')
if (( _RC != 0 )) if (( _RC > 0 ))
then then
(( $(pgrep -u root httpd 2>>${HC_STDERR_LOG} | wc -l 2>/dev/null) == 0 )) && _STC=1 (( $(pgrep -u root httpd 2>>${HC_STDERR_LOG} | wc -l 2>/dev/null) == 0 )) && _STC=1
fi fi
@ -136,7 +136,7 @@ cat <<- EOT
NAME : $1 NAME : $1
VERSION : $2 VERSION : $2
CONFIG : $3 CONFIG : $3
PURPOSE : Checks whether httpd (apache service) is running and whether the PURPOSE : Checks whether httpd (apache service) is running and whether the
httpd configuration files are syntactically correct httpd configuration files are syntactically correct
EOT EOT

View File

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

View File

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

View File

@ -23,7 +23,7 @@
# #
# @(#) HISTORY: # @(#) HISTORY:
# @(#) 2016-12-01: initial version [Patrick Van der Veken] # @(#) 2016-12-01: initial version [Patrick Van der Veken]
# @(#) 2017-05-08: suppress errors on postfix call + fix fall-back # @(#) 2017-05-08: suppress errors on postfix call + fix fall-back
# @(#) for sysv->pgrep[Patrick Van der Veken] # @(#) for sysv->pgrep[Patrick Van der Veken]
# @(#) 2018-05-21: STDERR fixes [Patrick Van der Veken] # @(#) 2018-05-21: STDERR fixes [Patrick Van der Veken]
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
@ -41,7 +41,7 @@ typeset _SUPPORTED_PLATFORMS="Linux" # uname -s match
# ------------------------- CONFIGURATION ends here --------------------------- # ------------------------- CONFIGURATION ends here ---------------------------
# set defaults # 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}" init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*") typeset _ARGS=$(data_space2comma "$*")
typeset _ARG="" typeset _ARG=""
@ -56,7 +56,7 @@ do
case "${_ARG}" in case "${_ARG}" in
help) help)
_show_usage $0 ${_VERSION} ${_CONFIG_FILE} && return 0 _show_usage $0 ${_VERSION} ${_CONFIG_FILE} && return 0
;; ;;
esac esac
done done
@ -89,7 +89,7 @@ case "${LINUX_INIT}" in
esac esac
# 2) try the postfix way # 2) try the postfix way
if (( _RC != 0 )) if (( _RC > 0 ))
then then
_POSTFIX_BIN="$(which postfix 2>>${HC_STDERR_LOG})" _POSTFIX_BIN="$(which postfix 2>>${HC_STDERR_LOG})"
if [[ -x ${_POSTFIX_BIN} && -n "${_POSTFIX_BIN}" ]] if [[ -x ${_POSTFIX_BIN} && -n "${_POSTFIX_BIN}" ]]

View File

@ -39,7 +39,7 @@ typeset _SUPPORTED_PLATFORMS="Linux" # uname -s match
# ------------------------- CONFIGURATION ends here --------------------------- # ------------------------- CONFIGURATION ends here ---------------------------
# set defaults # 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}" init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*") typeset _ARGS=$(data_space2comma "$*")
typeset _ARG="" typeset _ARG=""
@ -146,7 +146,7 @@ do
case "${_PROCESS_LIMIT}" in case "${_PROCESS_LIMIT}" in
"Max open files") "Max open files")
# collect ps info # 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}") _PROCESS_PS=$(_get_psinfo_by_process "${_PROCESS}")
if [[ -z "${_PROCESS_PS}" ]] if [[ -z "${_PROCESS_PS}" ]]
then then
@ -155,7 +155,7 @@ do
fi fi
print "${_PROCESS_PS}" | while read _PROCESS_PS_PID _PROCESS_PS_USER print "${_PROCESS_PS}" | while read _PROCESS_PS_PID _PROCESS_PS_USER
do 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 # get current values and check thresholds
_MAX_OPEN_FILES=$(_get_open_files ${_PROCESS_PS_PID}) _MAX_OPEN_FILES=$(_get_open_files ${_PROCESS_PS_PID})
# SOFT limit # SOFT limit
@ -210,7 +210,7 @@ do
case "${_USER_LIMIT}" in case "${_USER_LIMIT}" in
"Max open files") "Max open files")
# collect ps info # 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}") _USER_PS=$(_get_psinfo_by_user "${_USER}")
if [[ -z "${_USER_PS}" ]] if [[ -z "${_USER_PS}" ]]
then then
@ -219,7 +219,7 @@ do
fi fi
print "${_USER_PS}" | while read _USER_PS_PID _USER_PS_COMM print "${_USER_PS}" | while read _USER_PS_PID _USER_PS_COMM
do 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 # get current values and check thresholds
_MAX_OPEN_FILES=$(_get_open_files ${_USER_PS_PID}) _MAX_OPEN_FILES=$(_get_open_files ${_USER_PS_PID})
# SOFT limit # SOFT limit
@ -231,7 +231,7 @@ do
done done
;; ;;
"Max processes") "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}) _MAX_PROCESSES=$(_get_processes ${_USER})
# SOFT limit # SOFT limit
_check_limit "${_USER_LIMIT}" soft 0 ${_USER} "" ${_USER_SOFT_THRESHOLD} \ _check_limit "${_USER_LIMIT}" soft 0 ${_USER} "" ${_USER_SOFT_THRESHOLD} \
@ -259,7 +259,7 @@ return 0
#1992 root #1992 root
function _get_psinfo_by_process 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 ps -C "${1}" -o pid:1,user:1 --no-headers 2>/dev/null
@ -272,7 +272,7 @@ return 0
#8539 pickup #8539 pickup
function _get_psinfo_by_user 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 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_ENTRY=""
typeset _LIMIT_FIELD=0 typeset _LIMIT_FIELD=0
typeset _MSG_BIT="" 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 # check for empties
(( _LIMIT_PID == 0 )) && _LIMIT_PID="N/A" (( _LIMIT_PID == 0 )) && _LIMIT_PID="N/A"
@ -370,7 +370,7 @@ return 0
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
function _get_open_files 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 ls -f /proc/${1}/fd/ 2>/dev/null | wc -l 2>/dev/null
@ -380,7 +380,7 @@ return 0
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
function _get_processes 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 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 --------------------------- # ------------------------- CONFIGURATION ends here ---------------------------
# set defaults # 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}" init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*") typeset _ARGS=$(data_space2comma "$*")
typeset _ARG="" typeset _ARG=""
@ -54,13 +54,13 @@ do
case "${_ARG}" in case "${_ARG}" in
help) help)
_show_usage $0 ${_VERSION} ${_CONFIG_FILE} && return 0 _show_usage $0 ${_VERSION} ${_CONFIG_FILE} && return 0
;; ;;
esac esac
done done
# handle configuration file # handle configuration file
[[ -n "${ARG_CONFIG_FILE}" ]] && _CONFIG_FILE="${ARG_CONFIG_FILE}" [[ -n "${ARG_CONFIG_FILE}" ]] && _CONFIG_FILE="${ARG_CONFIG_FILE}"
if [[ ! -r ${_CONFIG_FILE} ]] if [[ ! -r ${_CONFIG_FILE} ]]
then then
warn "unable to read configuration file at ${_CONFIG_FILE}" warn "unable to read configuration file at ${_CONFIG_FILE}"
return 1 return 1
@ -92,7 +92,7 @@ then
fi fi
done done
fi fi
# perform check # perform check
grep -v -E -e '^$' -e '^#' ${_CONFIG_FILE} 2>/dev/null | while read _CRON_ENTRY grep -v -E -e '^$' -e '^#' ${_CONFIG_FILE} 2>/dev/null | while read _CRON_ENTRY
do do
@ -102,15 +102,15 @@ do
0) 0)
_MSG="'${_CRON_ENTRY}' is not configured in cron" _MSG="'${_CRON_ENTRY}' is not configured in cron"
_STC=1 _STC=1
;; ;;
1) 1)
_MSG="'${_CRON_ENTRY}' is configured in cron" _MSG="'${_CRON_ENTRY}' is configured in cron"
;; ;;
+([0-9])*([0-9])) +([0-9])*([0-9]))
_MSG="'${_CRON_ENTRY}' is configured multiple times in cron" _MSG="'${_CRON_ENTRY}' is configured multiple times in cron"
;; ;;
esac esac
# handle unit result # handle unit result
log_hc "$0" ${_STC} "${_MSG}" log_hc "$0" ${_STC} "${_MSG}"
_STC=0 _STC=0

View File

@ -43,7 +43,7 @@ typeset _SUPPORTED_PLATFORMS="Linux" # uname -s match
# ------------------------- CONFIGURATION ends here --------------------------- # ------------------------- CONFIGURATION ends here ---------------------------
# set defaults # 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}" init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*") typeset _ARGS=$(data_space2comma "$*")
typeset _ARG="" typeset _ARG=""
@ -57,7 +57,7 @@ do
case "${_ARG}" in case "${_ARG}" in
help) help)
_show_usage $0 ${_VERSION} ${_CONFIG_FILE} && return 0 _show_usage $0 ${_VERSION} ${_CONFIG_FILE} && return 0
;; ;;
esac esac
done done
@ -98,7 +98,7 @@ case "${LINUX_INIT}" in
esac esac
# 2) try the pgrep way (note: old pgreps do not support '-c') # 2) try the pgrep way (note: old pgreps do not support '-c')
if (( _RC != 0 )) if (( _RC > 0 ))
then then
(( $(pgrep -u root nmbd 2>>${HC_STDERR_LOG}| wc -l 2>/dev/null) == 0 )) && _STC=1 (( $(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 )) (( $(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 --------------------------- # ------------------------- CONFIGURATION ends here ---------------------------
# set defaults # 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 PATH=$PATH:/opt/cmcluster/bin
init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}" init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*") typeset _ARGS=$(data_space2comma "$*")
@ -109,7 +109,7 @@ else
_MSG="unable to gather cluster configuration" _MSG="unable to gather cluster configuration"
log_hc "$0" 1 "${_MSG}" log_hc "$0" 1 "${_MSG}"
# dump debug info # dump debug info
(( ARG_DEBUG != 0 && ARG_DEBUG_LEVEL > 0 )) && dump_logs (( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && dump_logs
return 0 return 0
} }
done done

View File

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

View File

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

View File

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

View File

@ -39,7 +39,7 @@ typeset _QS_AUTH_FILE="/opt/qs/conf/qs_authfile"
# ------------------------- CONFIGURATION ends here --------------------------- # ------------------------- CONFIGURATION ends here ---------------------------
# set defaults # 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}" init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*") typeset _ARGS=$(data_space2comma "$*")
typeset _ARG="" typeset _ARG=""

View File

@ -37,7 +37,7 @@ typeset _SUPPORTED_PLATFORMS="Linux" # uname -s match
# ------------------------- CONFIGURATION ends here --------------------------- # ------------------------- CONFIGURATION ends here ---------------------------
# set defaults # 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}" init_hc "$0" "${_SUPPORTED_PLATFORMS}" "${_VERSION}"
typeset _ARGS=$(data_space2comma "$*") typeset _ARGS=$(data_space2comma "$*")
typeset _ARG="" typeset _ARG=""
@ -50,7 +50,7 @@ do
case "${_ARG}" in case "${_ARG}" in
help) help)
_show_usage $0 ${_VERSION} ${_CONFIG_FILE} && return 0 _show_usage $0 ${_VERSION} ${_CONFIG_FILE} && return 0
;; ;;
esac esac
done done
@ -96,7 +96,7 @@ cat <<- EOT
NAME : $1 NAME : $1
VERSION : $2 VERSION : $2
CONFIG : $3 CONFIG : $3
PURPOSE : Checks whether shorewall (firewall) service is running and whether PURPOSE : Checks whether shorewall (firewall) service is running and whether
shorewall rules compile correctly shorewall rules compile correctly
EOT EOT

View File

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

View File

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

View File

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