Exit if SGE isn't available on a host

This commit is contained in:
Jeremy Gardais 2021-01-26 18:23:01 +01:00
parent cd8f4db423
commit 259fbd8531
Signed by: jegardai
GPG Key ID: E759BAA22501AF32
4 changed files with 90 additions and 1 deletions

View File

@ -68,6 +68,23 @@ debug_message() { # {{{
return 0
}
# }}}
is_sge_host() { # {{{
## Check if SGE commands (qhost) are available
if [ "$(command -v qhost)" ]; then
return_is_sge_host="0"
debug_message "is_sge_host \
SGE seems present on this host."
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_apt_upgrade_absent() { # {{{
## Check if temp APT upgrade file is absent
@ -211,7 +228,7 @@ procs running (with the pattern: ${RED}${local_proc_pattern}${COLOR_DEBUG}) on t
}
# }}}
prepare_host() { # {{{
prepare_host() { # {{{
debug_message "prepare_host \
Forbid SSH logins,…".
@ -247,6 +264,11 @@ main() { # {{{
manage_args "${ARGS}"
## If SGE is not yet available on this host
### Exit
is_sge_host \
|| exit 0
sge_hostname="$(hostname -f)"
sge_queues_name="$(qhost -h "${sge_hostname:=/dev/null}" -q -xml \
| grep "queue name" \

View File

@ -84,6 +84,23 @@ define_vars() { # {{{
| grep --max-count=1 -- "'slots_used'" \
| sed 's;.*<queuevalue.*>\(.*\)</queuevalue>;\1;')
}
# }}}
is_sge_host() { # {{{
## Check if SGE commands (qhost) are available
if [ "$(command -v qhost)" ]; then
return_is_sge_host="0"
debug_message "is_sge_host \
SGE seems present on this host."
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_apt_upgrade_absent() { # {{{
@ -156,6 +173,12 @@ main() { # {{{
## Define all vars
define_vars
## If SGE is not yet available on this host {{{
### Exit
is_sge_host \
|| exit 0
## }}}
## If NO APT package upgrade is available {{{
### Ensure to remove any temp file related to APT upgrades
### AND Exit

View File

@ -73,6 +73,23 @@ debug_message() { # {{{
return 0
}
# }}}
is_sge_host() { # {{{
## Check if SGE commands (qhost) are available
if [ "$(command -v qhost)" ]; then
return_is_sge_host="0"
debug_message "is_sge_host \
SGE seems present on this host."
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_apt_upgrade_present() { # {{{
## Check if temp APT upgrade file exists
@ -244,6 +261,11 @@ main() { # {{{
manage_args "${ARGS}"
## If SGE is not yet available on this host
### Exit
is_sge_host \
|| exit 0
sge_hostname="$(hostname -f)"
sge_queues_name="$(qhost -h "${sge_hostname:=/dev/null}" -q -xml \
| grep "queue name" \

View File

@ -147,6 +147,23 @@ ${sge_hostname} is not the current host."
sge_queue_flag_pattern="${cluster_dir}/.sge.*.disable"
}
# }}}
is_sge_host() { # {{{
## Check if SGE commands (qhost) are available
if [ "$(command -v qhost)" ]; then
return_is_sge_host="0"
debug_message "is_sge_host \
SGE seems present on this host."
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_current_host() { # {{{
local_current_host="${1}"
@ -427,6 +444,11 @@ main() { # {{{
## Define all vars according the selected options
define_vars
## If SGE is not yet available on this host
### Exit
is_sge_host \
|| exit 0
## If we need to watch for upgrades
if [ "${CHECK_UPGRADE}" -eq "0" ]; then
## If APT package upgrade is available