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() { # {{{
## If SGE is not yet available on this host
## If SGE is not yet available on this host {{{
### Exit
is_sge_host \
|| 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}"
@ -294,26 +316,8 @@ main() { # {{{
| grep "queue name" \
| 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)"
## If SGE Master is not reachable from this host {{{
### Exit
is_sge_master_available \
|| exit 0
## }}}
## If NO APT package upgrade is available
### Exit
is_apt_upgrade_absent \

View File

@ -29,7 +29,7 @@ readonly COLOR_DEBUG="${PURPLE}"
usage() { # {{{
cat <<- EOF
usage: $PROGNAME [-d|-e|-h|-t]
usage: $PROGNAME [-d|-e|-h]
Verify if any APT package upgrade is available and
try to prepare the host by:
@ -71,20 +71,6 @@ define_vars() { # {{{
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 [ -z "${EMPTY_ONLY_MODE}" ]; then
### Set False by default
@ -237,15 +223,30 @@ main() { # {{{
|| exit 0
## }}}
## Define all vars
define_vars
## 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
### If SGE Master is not reachable from this host {{{
#### Exit
is_sge_master_available \
|| exit 0
### }}}
## }}}
## Define all vars
define_vars
## If NO APT package upgrade is available {{{
### Ensure to remove any temp file related to APT upgrades
### AND Exit

View File

@ -278,10 +278,32 @@ Try to clean temp files,…"
# }}}
main() { # {{{
## If SGE is not yet available on this host
## If SGE is not yet available on this host {{{
### Exit
is_sge_host \
|| 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}"
@ -293,24 +315,6 @@ main() { # {{{
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)"
## 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
### Exit (wait for APT upgrade to be applied first)
is_apt_upgrade_present \

View File

@ -253,21 +253,25 @@ Disable SGE queue."
# }}}
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
## 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 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
### }}}
### If SGE Master is not reachable from this host {{{
#### Exit
is_sge_master_available \
|| exit 0
### }}}
## }}}
## Get all Maco's versions (date)

View File

@ -97,18 +97,6 @@ define_vars() { # {{{
sge_hostname="$(hostname -f)"
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 is_current_host "${sge_hostname}" ; then
debug_message "define_vars \
@ -473,20 +461,36 @@ Previously disabled by a script (or FORCE is enable), try to enable SGE queue: $
# }}}
main() { # {{{
## If SGE is not yet available on this host
## If SGE is not yet available on this host {{{
### Exit
is_sge_host \
|| 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_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 [ "${CHECK_UPGRADE}" -eq "0" ]; then
## If APT package upgrade is available