Better exit codes + fix for cleanup
This commit is contained in:
parent
ada5fbb1e2
commit
f9db229bd5
@ -27,6 +27,7 @@
|
|||||||
# + include functions
|
# + include functions
|
||||||
# For other pre-requisites see the documentation in display_usage()
|
# For other pre-requisites see the documentation in display_usage()
|
||||||
# REQUIRES (OPTIONAL): display_*(), notify_*(), report_*()
|
# REQUIRES (OPTIONAL): display_*(), notify_*(), report_*()
|
||||||
|
# EXISTS: 0=no errors encountered, >0=some errors encountered
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
# DO NOT CHANGE THIS FILE UNLESS YOU KNOW WHAT YOU ARE DOING!
|
# DO NOT CHANGE THIS FILE UNLESS YOU KNOW WHAT YOU ARE DOING!
|
||||||
#******************************************************************************
|
#******************************************************************************
|
||||||
@ -37,7 +38,7 @@
|
|||||||
|
|
||||||
# ------------------------- CONFIGURATION starts here -------------------------
|
# ------------------------- CONFIGURATION starts here -------------------------
|
||||||
# define the version (YYYY-MM-DD)
|
# define the version (YYYY-MM-DD)
|
||||||
typeset -r SCRIPT_VERSION="2019-01-24"
|
typeset -r SCRIPT_VERSION="2019-01-31"
|
||||||
# location of parent directory containing KSH functions/HC plugins
|
# location of parent directory containing KSH functions/HC plugins
|
||||||
typeset -r FPATH_PARENT="/opt/hc/lib"
|
typeset -r FPATH_PARENT="/opt/hc/lib"
|
||||||
# location of custom HC configuration files
|
# location of custom HC configuration files
|
||||||
@ -1172,7 +1173,7 @@ case ${ARG_ACTION} in
|
|||||||
display_init "${HC_RUN}" "" "MISSING"
|
display_init "${HC_RUN}" "" "MISSING"
|
||||||
else
|
else
|
||||||
warn "cannot find HC: ${HC_RUN}"
|
warn "cannot find HC: ${HC_RUN}"
|
||||||
EXIT_CODE=${RUN_RC}
|
EXIT_CODE=1
|
||||||
fi
|
fi
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
@ -1185,7 +1186,7 @@ case ${ARG_ACTION} in
|
|||||||
display_init "${HC_RUN}" "" "DISABLED"
|
display_init "${HC_RUN}" "" "DISABLED"
|
||||||
else
|
else
|
||||||
warn "may not run disabled HC: ${HC_RUN}"
|
warn "may not run disabled HC: ${HC_RUN}"
|
||||||
EXIT_CODE=${RUN_RC}
|
EXIT_CODE=0
|
||||||
fi
|
fi
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
@ -24,8 +24,9 @@
|
|||||||
# @(#) HISTORY:
|
# @(#) HISTORY:
|
||||||
# @(#) 2019-01-24: initial version [Patrick Van der Veken]
|
# @(#) 2019-01-24: initial version [Patrick Van der Veken]
|
||||||
# @(#) 2019-01-27: regex fix [Patrick Van der Veken]
|
# @(#) 2019-01-27: regex fix [Patrick Van der Veken]
|
||||||
# @(#) 2019-01-30: refactored to support custom defintions with all
|
# @(#) 2019-01-30: refactored to support custom definitions with all
|
||||||
# filesystems check [Patrick Van der Veken]
|
# filesystems check [Patrick Van der Veken]
|
||||||
|
# @(#) 2019-02-04: fix in cleanup
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
# DO NOT CHANGE THIS FILE UNLESS YOU KNOW WHAT YOU ARE DOING!
|
# DO NOT CHANGE THIS FILE UNLESS YOU KNOW WHAT YOU ARE DOING!
|
||||||
#******************************************************************************
|
#******************************************************************************
|
||||||
@ -35,7 +36,7 @@ function check_linux_fs_usage
|
|||||||
{
|
{
|
||||||
# ------------------------- CONFIGURATION starts here -------------------------
|
# ------------------------- CONFIGURATION starts here -------------------------
|
||||||
typeset _CONFIG_FILE="${CONFIG_DIR}/$0.conf"
|
typeset _CONFIG_FILE="${CONFIG_DIR}/$0.conf"
|
||||||
typeset _VERSION="2019-01-30" # YYYY-MM-DD
|
typeset _VERSION="2019-02-04" # YYYY-MM-DD
|
||||||
typeset _SUPPORTED_PLATFORMS="Linux" # uname -s match
|
typeset _SUPPORTED_PLATFORMS="Linux" # uname -s match
|
||||||
# ------------------------- CONFIGURATION ends here ---------------------------
|
# ------------------------- CONFIGURATION ends here ---------------------------
|
||||||
|
|
||||||
@ -64,7 +65,7 @@ typeset _SPACE_FILE="${TMP_DIR}/.$0.space.$$"
|
|||||||
|
|
||||||
# set local trap for cleanup
|
# set local trap for cleanup
|
||||||
# shellcheck disable=SC2064
|
# shellcheck disable=SC2064
|
||||||
trap "rm -f ${_SPACE_FILE}.* ${_INODES_FILE}.* >/dev/null 2>&1; return 1" 1 2 3 15
|
trap "rm -f ${_SPACE_FILE} ${_INODES_FILE} >/dev/null 2>&1; return 1" 1 2 3 15
|
||||||
|
|
||||||
# handle arguments (originally comma-separated)
|
# handle arguments (originally comma-separated)
|
||||||
for _ARG in ${_ARGS}
|
for _ARG in ${_ARGS}
|
||||||
@ -303,7 +304,7 @@ then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# do cleanup
|
# do cleanup
|
||||||
rm -f ${_INODES_FILE}.* ${_SPACE_FILE}.* >/dev/null 2>&1
|
rm -f ${_INODES_FILE} ${_SPACE_FILE} >/dev/null 2>&1
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user