Add debug_message function

This commit is contained in:
Jeremy Gardais 2020-06-04 11:31:13 +02:00
parent d317376171
commit 4cfedce127
Signed by: jegardai
GPG Key ID: E759BAA22501AF32
1 changed files with 13 additions and 4 deletions

View File

@ -50,6 +50,15 @@ EXAMPLES:
${PROGNAME} marvin.domain.tld
EOF
}
# }}}
debug_message() { # {{{
local_message="${1}"
## Print message if DEBUG is enable (=0)
[ "${DEBUG}" -eq "0" ] && printf '\e[1;35m%-6b\e[m\n' "DEBUG ${PROGNAME}: ${local_message}"
}
# }}}
is_queue_enable() { # {{{
@ -76,7 +85,7 @@ is_queue_enable() { # {{{
esac
## Simple debug message to valid current variables
[ "${DEBUG}" -eq "0" ] && printf '\e[1;35m%-6b\e[m\n' "DEBUG ${PROGNAME}: is_queue_enable \
debug_message "is_queue_enable \
SGE queue: ${RED}${local_sge_queue_name:=/dev/null}${COLOR_DEBUG} \
state is: ${RED}${local_sge_queue_state:=/dev/null}${COLOR_DEBUG}."
@ -108,7 +117,7 @@ is_queue_disable() { # {{{
esac
## Simple debug message to valid current variables
[ "${DEBUG}" -eq "0" ] && printf '\e[1;35m%-6b\e[m\n' "DEBUG ${PROGNAME}: is_queue_disable \
debug_message "is_queue_disable \
SGE queue: ${RED}${local_sge_queue_name:=/dev/null}${COLOR_DEBUG} \
state is: ${RED}${local_sge_queue_state:=/dev/null}${COLOR_DEBUG}."
@ -122,7 +131,7 @@ disable_sge_queue() { # {{{
local_sge_queue_name="${2}"
## Simple debug message to valid current variables
[ "${DEBUG}" -eq "0" ] && printf '\e[1;35m%-6b\e[m\n' "DEBUG ${PROGNAME}: disable_sge_queue \
debug_message "disable_sge_queue \
Try to disable SGE queue: ${RED}${local_sge_queue_name:=/dev/null}@${local_sge_hostname:=/dev/null}${COLOR_DEBUG}."
## SGE command to disable the queue
@ -142,7 +151,7 @@ main() { # {{{
| cut -d"'" -f2 )"
## Simple debug message with color to valid current variables
[ "${DEBUG}" -eq "0" ] && printf '\e[1;35m%-6b\e[m\n' "DEBUG ${PROGNAME}: main Try to manage \
debug_message "main Try to manage \
SGE queue: ${RED}${sge_queue_name:=/dev/null}${COLOR_DEBUG} \
for host: ${RED}${sge_hostname:=/dev/null}${COLOR_DEBUG}."