diff --git a/core/base.module.sh b/core/base.module.sh index 2f706c3..0db72db 100755 --- a/core/base.module.sh +++ b/core/base.module.sh @@ -72,7 +72,7 @@ function prepare.setCIS() { _ROOT_TRUNK="${_FULLSCRIPTNAME%cis/*}" while [ ! -d "${_ROOT_TRUNK}cis/core/" ]; do - [ "${_ROOT_TRUNK}" == "${0}" ] \ + [ "${_ROOT_TRUNK}" == "${_FULLSCRIPTNAME}" ] \ && base.abort ' Unable to find root folder of CIS!' 'It seams the script does not belong to CIS.' [ "${_ROOT_TRUNK}" == "/" ] \ diff --git a/definitions/default/monitor/checks/EXAMPLE_CHECK.off b/definitions/default/monitor/checks/EXAMPLE_CHECK.off index 72fa71f..54522db 100755 --- a/definitions/default/monitor/checks/EXAMPLE_CHECK.off +++ b/definitions/default/monitor/checks/EXAMPLE_CHECK.off @@ -1,9 +1,6 @@ #!/bin/bash +source /cis/core/base.module.sh -_CHECK="$(readlink -f "${0}" 2> /dev/null)" -# Folders always ends with an tailing '/' -_CIS_ROOT="${_CHECK%%/definitions/*}/" #Removes longest matching pattern '/definitions/*' from the end -_GENERIC_CHECKS="${_CIS_ROOT:?"Missing CIS_ROOT"}script/monitor/generic/" -${_GENERIC_CHECKS:?"Missing GENERIC_CHECKS"}CIS_OWN_DOMAIN_CHECK.sh "your-host.your-domain.net[:ssh_port]" +${CIS[GENERICMONITORCHECKS]:?"Missing GENERICMONITORCHECKS"}CIS_OWN_DOMAIN_CHECK.sh "your-host.your-domain.net[:ssh_port]" diff --git a/module/log.module.sh b/module/log.module.sh index 84a955b..a48127f 100755 --- a/module/log.module.sh +++ b/module/log.module.sh @@ -1,5 +1,7 @@ - #!/bin/bash +source /cis/core/base.module.sh + + #Function, to highlight bad messages. function log.bad() { @@ -134,9 +136,7 @@ function log.optional(){ #Function, to start a script. function log.start(){ local _MESSAGE="${@:-""}" - local _CISROOT="${CIS[ROOT]:?"log.start(): Missing CIS[ROOT]."}" - local _SCRIPTDIR="${CIS[SCRIPTDIR]:?"log.start(): Missing CIS[SCRIPTDIR]."}" - local _SERVICE="$(echo "${_SCRIPTDIR##${_CISROOT}/}" | tr '[:lower:]' '[:upper:]')" + local _SERVICE="$(echo "${_SCRIPTDIR##${CIS[ROOT]:?"log.start(): Missing CIS[ROOT]"}/}" | tr '[:lower:]' '[:upper:]')" local _COMMAND="${CIS[SCRIPTNAME]:?"log.start(): Missing CIS[SCRIPTNAME]."}" [ -z "${_MESSAGE:-""}" ] \