Exit if SGE is not configured on hosts

This commit is contained in:
Jeremy Gardais 2021-12-22 11:03:26 +01:00
parent 15992d9393
commit 700d6d2c5c
Signed by: jegardai
GPG Key ID: E759BAA22501AF32
2 changed files with 66 additions and 0 deletions

View File

@ -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

View File

@ -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