From 700d6d2c5c881df20a09224bd4a662a2c8ec1570 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gardais=20J=C3=A9r=C3=A9my?= Date: Wed, 22 Dec 2021 11:03:26 +0100 Subject: [PATCH] Exit if SGE is not configured on hosts --- cluster/maco.check.update.sh | 33 +++++++++++++++++++++++++++++++ cluster/sge.disable.host.queue.sh | 33 +++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+) diff --git a/cluster/maco.check.update.sh b/cluster/maco.check.update.sh index 66eab53..20788dc 100755 --- a/cluster/maco.check.update.sh +++ b/cluster/maco.check.update.sh @@ -133,6 +133,33 @@ Test var: ${1}." return "${return_var_empty}" +} +# }}} +is_sge_host() { # {{{ + + ## Check if SGE commands (qconf) are available + if [ "$(command -v qconf)" ]; then + debug_message "is_sge_host − \ +SGE seems present on this host." + + ### And verify if the host is fully configured as a submit host + if qconf -ss 2>/dev/null | grep --word-regexp --quiet $(hostname -f); then + debug_message "is_sge_host − \ +The host seems configured as a SGE submit host." + return_is_sge_host="0" + else + return_is_sge_host="1" + debug_message "is_sge_host − \ +This host is not yet configured as a SGE submit host." + fi + else + return_is_sge_host="1" + debug_message "is_sge_host − \ +SGE is not present on this host." + fi + + return "${return_is_sge_host}" + } # }}} is_sge_master_available() { # {{{ @@ -313,6 +340,12 @@ main() { # {{{ ### }}} ## }}} + ## If SGE is not yet available on this host {{{ + ### Exit + is_sge_host \ + || exit 0 + ## }}} + ## If MACO_FAILED_MODE wasn't defined (argument, environment variable,…) {{{ if [ -z "${MACO_FAILED_MODE}" ]; then ### Set False by default diff --git a/cluster/sge.disable.host.queue.sh b/cluster/sge.disable.host.queue.sh index 04d1cb3..81975d1 100755 --- a/cluster/sge.disable.host.queue.sh +++ b/cluster/sge.disable.host.queue.sh @@ -98,6 +98,33 @@ FORCE MODE is enable, don't manage anything related to a localhost." ## }}} } # }}} +is_sge_host() { # {{{ + + ## Check if SGE commands (qconf) are available + if [ "$(command -v qconf)" ]; then + debug_message "is_sge_host − \ +SGE seems present on this host." + + ### And verify if the host is fully configured as a submit host + if qconf -ss 2>/dev/null | grep --word-regexp --quiet $(hostname -f); then + debug_message "is_sge_host − \ +The host seems configured as a SGE submit host." + return_is_sge_host="0" + else + return_is_sge_host="1" + debug_message "is_sge_host − \ +This host is not yet configured as a SGE submit host." + fi + else + return_is_sge_host="1" + debug_message "is_sge_host − \ +SGE is not present on this host." + fi + + return "${return_is_sge_host}" + +} +# }}} is_sge_master_available() { # {{{ ## Check with Netcat if SGE master (sge_qmaster) is reachable from this host. @@ -269,6 +296,12 @@ main() { # {{{ ### }}} ## }}} + ## If SGE is not yet available on this host {{{ + ### Exit + is_sge_host \ + || exit 0 + ## }}} + ## Define all vars according the selected options define_vars