Test earlier if SGE Master is reachable

This commit is contained in:
Jeremy Gardais 2021-04-20 07:26:35 +02:00
parent 5d3d047223
commit 194d488340
Signed by: jegardai
GPG Key ID: E759BAA22501AF32
5 changed files with 98 additions and 81 deletions

View File

@ -281,10 +281,32 @@ Try to clean temp files, downloaded packages,…".
# }}} # }}}
main() { # {{{ main() { # {{{
## If SGE is not yet available on this host ## If SGE is not yet available on this host {{{
### Exit ### Exit
is_sge_host \ is_sge_host \
|| exit 0 || exit 0
## }}}
## Test if SGE Master is reachable {{{
### If sge_master_uri wasn't defined (environment variable,…) {{{
if [ -z "${sge_master_uri}" ]; then
## Use local host for sge_master_uri
sge_master_uri="physix-master.ipr.univ-rennes1.fr"
fi
### }}}
### If sge_master_port wasn't defined (environment variable,…) {{{
if [ -z "${sge_master_port}" ]; then
## Use local host for sge_master_port
sge_master_port="6444"
fi
### }}}
### If SGE Master is not reachable from this host {{{
#### Exit
is_sge_master_available \
|| exit 0
### }}}
## }}}
manage_args "${ARGS}" manage_args "${ARGS}"
@ -294,26 +316,8 @@ main() { # {{{
| grep "queue name" \ | grep "queue name" \
| cut -d"'" -f2 )" | cut -d"'" -f2 )"
## If sge_master_uri wasn't defined (environment variable,…)
if [ -z "${sge_master_uri}" ]; then
## Use local host for sge_master_uri
sge_master_uri="physix-master.ipr.univ-rennes1.fr"
fi
## If sge_master_port wasn't defined (environment variable,…)
if [ -z "${sge_master_port}" ]; then
## Use local host for sge_master_port
sge_master_port="6444"
fi
maco_proc_pattern="(/opt/maco/bin/maco.autoupdate.sh)" maco_proc_pattern="(/opt/maco/bin/maco.autoupdate.sh)"
## If SGE Master is not reachable from this host {{{
### Exit
is_sge_master_available \
|| exit 0
## }}}
## If NO APT package upgrade is available ## If NO APT package upgrade is available
### Exit ### Exit
is_apt_upgrade_absent \ is_apt_upgrade_absent \

View File

@ -29,7 +29,7 @@ readonly COLOR_DEBUG="${PURPLE}"
usage() { # {{{ usage() { # {{{
cat <<- EOF cat <<- EOF
usage: $PROGNAME [-d|-e|-h|-t] usage: $PROGNAME [-d|-e|-h]
Verify if any APT package upgrade is available and Verify if any APT package upgrade is available and
try to prepare the host by: try to prepare the host by:
@ -71,20 +71,6 @@ define_vars() { # {{{
fi fi
## }}} ## }}}
## If sge_master_uri wasn't defined (environment variable,…) {{{
if [ -z "${sge_master_uri}" ]; then
## Use local host for sge_master_uri
sge_master_uri="physix-master.ipr.univ-rennes1.fr"
fi
## }}}
## If sge_master_port wasn't defined (environment variable,…) {{{
if [ -z "${sge_master_port}" ]; then
## Use local host for sge_master_port
sge_master_port="6444"
fi
## }}}
## If EMPTY_ONLY_MODE wasn't defined (argument, environment variable,…) {{{ ## If EMPTY_ONLY_MODE wasn't defined (argument, environment variable,…) {{{
if [ -z "${EMPTY_ONLY_MODE}" ]; then if [ -z "${EMPTY_ONLY_MODE}" ]; then
### Set False by default ### Set False by default
@ -237,15 +223,30 @@ main() { # {{{
|| exit 0 || exit 0
## }}} ## }}}
## Define all vars ## Test if SGE Master is reachable {{{
define_vars ### If sge_master_uri wasn't defined (environment variable,…) {{{
if [ -z "${sge_master_uri}" ]; then
## Use local host for sge_master_uri
sge_master_uri="physix-master.ipr.univ-rennes1.fr"
fi
### }}}
### If sge_master_port wasn't defined (environment variable,…) {{{
if [ -z "${sge_master_port}" ]; then
## Use local host for sge_master_port
sge_master_port="6444"
fi
### }}}
## If SGE Master is not reachable from this host {{{ ### If SGE Master is not reachable from this host {{{
### Exit #### Exit
is_sge_master_available \ is_sge_master_available \
|| exit 0 || exit 0
### }}}
## }}} ## }}}
## Define all vars
define_vars
## If NO APT package upgrade is available {{{ ## If NO APT package upgrade is available {{{
### Ensure to remove any temp file related to APT upgrades ### Ensure to remove any temp file related to APT upgrades
### AND Exit ### AND Exit

View File

@ -278,10 +278,32 @@ Try to clean temp files,…"
# }}} # }}}
main() { # {{{ main() { # {{{
## If SGE is not yet available on this host ## If SGE is not yet available on this host {{{
### Exit ### Exit
is_sge_host \ is_sge_host \
|| exit 0 || exit 0
## }}}
## Test if SGE Master is reachable {{{
### If sge_master_uri wasn't defined (environment variable,…) {{{
if [ -z "${sge_master_uri}" ]; then
## Use local host for sge_master_uri
sge_master_uri="physix-master.ipr.univ-rennes1.fr"
fi
### }}}
### If sge_master_port wasn't defined (environment variable,…) {{{
if [ -z "${sge_master_port}" ]; then
## Use local host for sge_master_port
sge_master_port="6444"
fi
### }}}
### If SGE Master is not reachable from this host {{{
#### Exit
is_sge_master_available \
|| exit 0
### }}}
## }}}
manage_args "${ARGS}" manage_args "${ARGS}"
@ -293,24 +315,6 @@ main() { # {{{
maco_proc_pattern="(/opt/maco/bin/maco.autoupdate.sh)" maco_proc_pattern="(/opt/maco/bin/maco.autoupdate.sh)"
apt_proc_pattern="(aptitude.*full-upgrade|/usr/bin/dpkg.*--configure|dpkg-deb|/bin/sh /usr/lib/needrestart/dpkg-status)" apt_proc_pattern="(aptitude.*full-upgrade|/usr/bin/dpkg.*--configure|dpkg-deb|/bin/sh /usr/lib/needrestart/dpkg-status)"
## If sge_master_uri wasn't defined (environment variable,…)
if [ -z "${sge_master_uri}" ]; then
## Use local host for sge_master_uri
sge_master_uri="physix-master.ipr.univ-rennes1.fr"
fi
## If sge_master_port wasn't defined (environment variable,…)
if [ -z "${sge_master_port}" ]; then
## Use local host for sge_master_port
sge_master_port="6444"
fi
## If SGE Master is not reachable from this host {{{
### Exit
is_sge_master_available \
|| exit 0
## }}}
## If APT package upgrade is available ## If APT package upgrade is available
### Exit (wait for APT upgrade to be applied first) ### Exit (wait for APT upgrade to be applied first)
is_apt_upgrade_present \ is_apt_upgrade_present \

View File

@ -253,21 +253,25 @@ Disable SGE queue."
# }}} # }}}
main() { # {{{ main() { # {{{
## If sge_master_uri wasn't defined (environment variable,…) ## Test if SGE Master is reachable {{{
### If sge_master_uri wasn't defined (environment variable,…) {{{
if [ -z "${sge_master_uri}" ]; then if [ -z "${sge_master_uri}" ]; then
## Use local host for sge_master_uri ## Use local host for sge_master_uri
sge_master_uri="physix-master.ipr.univ-rennes1.fr" sge_master_uri="physix-master.ipr.univ-rennes1.fr"
fi fi
### }}}
## If sge_master_port wasn't defined (environment variable,…) ### If sge_master_port wasn't defined (environment variable,…) {{{
if [ -z "${sge_master_port}" ]; then if [ -z "${sge_master_port}" ]; then
## Use local host for sge_master_port ## Use local host for sge_master_port
sge_master_port="6444" sge_master_port="6444"
fi fi
## If SGE Master is not reachable from this host {{{ ### }}}
### Exit
### If SGE Master is not reachable from this host {{{
#### Exit
is_sge_master_available \ is_sge_master_available \
|| exit 0 || exit 0
### }}}
## }}} ## }}}
## Get all Maco's versions (date) ## Get all Maco's versions (date)

View File

@ -97,18 +97,6 @@ define_vars() { # {{{
sge_hostname="$(hostname -f)" sge_hostname="$(hostname -f)"
fi fi
## If sge_master_uri wasn't defined (environment variable,…)
if [ -z "${sge_master_uri}" ]; then
## Use local host for sge_master_uri
sge_master_uri="physix-master.ipr.univ-rennes1.fr"
fi
## If sge_master_port wasn't defined (environment variable,…)
if [ -z "${sge_master_port}" ]; then
## Use local host for sge_master_port
sge_master_port="6444"
fi
## If the host to manage is the current one ## If the host to manage is the current one
if is_current_host "${sge_hostname}" ; then if is_current_host "${sge_hostname}" ; then
debug_message "define_vars \ debug_message "define_vars \
@ -473,20 +461,36 @@ Previously disabled by a script (or FORCE is enable), try to enable SGE queue: $
# }}} # }}}
main() { # {{{ main() { # {{{
## If SGE is not yet available on this host ## If SGE is not yet available on this host {{{
### Exit ### Exit
is_sge_host \ is_sge_host \
|| exit 0 || exit 0
## }}}
## Test if SGE Master is reachable {{{
### If sge_master_uri wasn't defined (environment variable,…) {{{
if [ -z "${sge_master_uri}" ]; then
## Use local host for sge_master_uri
sge_master_uri="physix-master.ipr.univ-rennes1.fr"
fi
### }}}
### If sge_master_port wasn't defined (environment variable,…) {{{
if [ -z "${sge_master_port}" ]; then
## Use local host for sge_master_port
sge_master_port="6444"
fi
### }}}
### If SGE Master is not reachable from this host {{{
#### Exit
is_sge_master_available \
|| exit 0
### }}}
## }}}
## Define all vars according the selected options ## Define all vars according the selected options
define_vars define_vars
## If SGE Master is not reachable from this host {{{
### Exit
is_sge_master_available \
|| exit 0
## }}}
## If we need to watch for upgrades ## If we need to watch for upgrades
if [ "${CHECK_UPGRADE}" -eq "0" ]; then if [ "${CHECK_UPGRADE}" -eq "0" ]; then
## If APT package upgrade is available ## If APT package upgrade is available