diff --git a/cluster/apt.apply.update.sh b/cluster/apt.apply.update.sh index b403e4b..8a45e71 100755 --- a/cluster/apt.apply.update.sh +++ b/cluster/apt.apply.update.sh @@ -291,17 +291,11 @@ Try to clean temp files, downloaded packages,…". # }}} main() { # {{{ - ## 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" + ## Get SGE master from current configuration + sge_master_uri=$(grep --max-count=1 -- "" /var/lib/gridengine/default/common/act_qmaster 2>/dev/null || echo "NO MASTER") fi ### }}} ### If sge_master_port wasn't defined (environment variable,…) {{{ @@ -318,6 +312,12 @@ main() { # {{{ ### }}} ## }}} + ## If SGE is not yet available on this host {{{ + ### Exit + is_sge_host \ + || exit 0 + ## }}} + manage_args "${ARGS}" ## Define vars diff --git a/cluster/apt.check.update.sh b/cluster/apt.check.update.sh index 426317a..53173f6 100755 --- a/cluster/apt.check.update.sh +++ b/cluster/apt.check.update.sh @@ -227,17 +227,11 @@ SGE slots currently in use: ${RED}${sge_slots_used:=/dev/null}${COLOR_DEBUG}." # }}} main() { # {{{ - ## 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" + ## Get SGE master from current configuration + sge_master_uri=$(grep --max-count=1 -- "" /var/lib/gridengine/default/common/act_qmaster 2>/dev/null || echo "NO MASTER") fi ### }}} ### If sge_master_port wasn't defined (environment variable,…) {{{ @@ -254,6 +248,12 @@ main() { # {{{ ### }}} ## }}} + ## If SGE is not yet available on this host {{{ + ### Exit + is_sge_host \ + || exit 0 + ## }}} + ## Define all vars define_vars diff --git a/cluster/maco.apply.update.sh b/cluster/maco.apply.update.sh index 0ca3d54..5cdf93e 100755 --- a/cluster/maco.apply.update.sh +++ b/cluster/maco.apply.update.sh @@ -288,17 +288,11 @@ Try to clean temp files,…" # }}} main() { # {{{ - ## 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" + ## Get SGE master from current configuration + sge_master_uri=$(grep --max-count=1 -- "" /var/lib/gridengine/default/common/act_qmaster 2>/dev/null || echo "NO MASTER") fi ### }}} ### If sge_master_port wasn't defined (environment variable,…) {{{ @@ -315,6 +309,12 @@ main() { # {{{ ### }}} ## }}} + ## If SGE is not yet available on this host {{{ + ### Exit + is_sge_host \ + || exit 0 + ## }}} + manage_args "${ARGS}" sge_hostname="$(hostname -f)" diff --git a/cluster/maco.check.update.sh b/cluster/maco.check.update.sh index 9fbdb75..e8fa12e 100755 --- a/cluster/maco.check.update.sh +++ b/cluster/maco.check.update.sh @@ -295,8 +295,8 @@ main() { # {{{ ## 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" + ## Get SGE master from current configuration + sge_master_uri=$(grep --max-count=1 -- "" /var/lib/gridengine/default/common/act_qmaster 2>/dev/null || echo "NO MASTER") fi ### }}} ### If sge_master_port wasn't defined (environment variable,…) {{{ diff --git a/cluster/sge.disable.host.queue.sh b/cluster/sge.disable.host.queue.sh index cbe1d82..184b9fb 100755 --- a/cluster/sge.disable.host.queue.sh +++ b/cluster/sge.disable.host.queue.sh @@ -66,20 +66,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 the given host to manage is the current one {{{ if is_current_host "${sge_hostname}" ; then debug_message "define_vars − \ @@ -262,15 +248,30 @@ Try to disable SGE queue: ${RED}${local_sge_queue_name:=/dev/null}@${local_sge_h # }}} main() { # {{{ - ## Define all vars according the selected options - define_vars + ## Test if SGE Master is reachable {{{ + ### If sge_master_uri wasn't defined (environment variable,…) {{{ + if [ -z "${sge_master_uri}" ]; then + ## Get SGE master from current configuration + sge_master_uri=$(grep --max-count=1 -- "" /var/lib/gridengine/default/common/act_qmaster 2>/dev/null || echo "NO MASTER") + 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 according the selected options + define_vars + ## Simple debug message with color to valid current variables debug_message "main − Try to manage \ SGE queue(s): ${RED}${sge_queues_name_print:=/dev/null}${COLOR_DEBUG}\ diff --git a/cluster/sge.enable.host.queue.sh b/cluster/sge.enable.host.queue.sh index 94ec4df..ef0bbd7 100755 --- a/cluster/sge.enable.host.queue.sh +++ b/cluster/sge.enable.host.queue.sh @@ -521,17 +521,11 @@ Previously disabled by a script (or FORCE is enable), try to enable SGE queue: $ # }}} main() { # {{{ - ## 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" + ## Get SGE master from current configuration + sge_master_uri=$(grep --max-count=1 -- "" /var/lib/gridengine/default/common/act_qmaster 2>/dev/null || echo "NO MASTER") fi ### }}} ### If sge_master_port wasn't defined (environment variable,…) {{{ @@ -548,6 +542,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