FORCE_MODE: Don't manage host as a localhost

This commit is contained in:
Jeremy Gardais 2021-11-23 16:45:01 +01:00
parent 4b0ee6da93
commit 9d31d4ab02
Signed by: jegardai
GPG Key ID: E759BAA22501AF32
1 changed files with 19 additions and 6 deletions

View File

@ -59,25 +59,28 @@ debug_message() { # {{{
# }}} # }}}
define_vars() { # {{{ define_vars() { # {{{
## If sge_hostname wasn't defined ## If sge_hostname wasn't defined {{{
if [ -z "${sge_hostname}" ]; then if [ -z "${sge_hostname}" ]; then
## Use local host for sge_hostname ## Use local host for sge_hostname
sge_hostname="$(hostname -f)" sge_hostname="$(hostname -f)"
fi fi
## }}}
## If sge_master_uri wasn't defined (environment variable,…) ## 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 the host to manage is the current one ## If the given 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 \
${sge_hostname} is the current host." ${sge_hostname} is the current host."
@ -87,8 +90,18 @@ ${sge_hostname} is the current host."
${sge_hostname} is not the current host." ${sge_hostname} is not the current host."
LOCAL_HOST="1" LOCAL_HOST="1"
fi fi
## }}}
## Get all queues name ## If FORCE_MODE was defined and enabled {{{
if [ "${FORCE_MODE}" -eq "0" ]; then
debug_message "define_vars \
FORCE MODE is enable, don't manage anything related to a localhost."
## Don't manage configuration specific to a localhost
LOCAL_HOST="1"
fi
## }}}
## Get all queues name {{{
sge_queues_name="$(qhost -h "${sge_hostname:=/dev/null}" -q -xml \ sge_queues_name="$(qhost -h "${sge_hostname:=/dev/null}" -q -xml \
| grep "queue name" \ | grep "queue name" \
| cut -d"'" -f2 )" | cut -d"'" -f2 )"
@ -96,7 +109,7 @@ ${sge_hostname} is not the current host."
| grep "queue name" \ | grep "queue name" \
| cut -d"'" -f2 \ | cut -d"'" -f2 \
| tr -s '\n' ' ' )" | tr -s '\n' ' ' )"
## }}}
} }
# }}} # }}}
is_sge_master_available() { # {{{ is_sge_master_available() { # {{{