Check APT upgrade if SGE queue is already disable

This commit is contained in:
Jeremy Gardais 2021-04-12 09:26:55 +02:00
parent ecea1311cc
commit 903143a00e
Signed by: jegardai
GPG Key ID: E759BAA22501AF32
1 changed files with 22 additions and 5 deletions

View File

@ -64,29 +64,33 @@ debug_message() { # {{{
# }}} # }}}
define_vars() { # {{{ define_vars() { # {{{
## If sge_hostname wasn't defined (environment variable,…) ## If sge_hostname wasn't defined (environment variable,…) {{{
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 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
EMPTY_ONLY_MODE="1" EMPTY_ONLY_MODE="1"
fi fi
## }}}
## Script used to disable SGE queue(s) ## Script used to disable SGE queue(s)
sge_disable_host_queue_script="${PROGDIR}/sge.disable.host.queue.sh" sge_disable_host_queue_script="${PROGDIR}/sge.disable.host.queue.sh"
@ -96,6 +100,9 @@ define_vars() { # {{{
| grep --max-count=1 -- "'slots_used'" \ | grep --max-count=1 -- "'slots_used'" \
| sed 's;.*<queuevalue.*>\(.*\)</queuevalue>;\1;') | sed 's;.*<queuevalue.*>\(.*\)</queuevalue>;\1;')
## SGE queues state file
cluster_dir="/opt/ipr/cluster"
sge_queue_flag_pattern="${cluster_dir}/.sge.*.disable"
} }
# }}} # }}}
is_sge_host() { # {{{ is_sge_host() { # {{{
@ -253,6 +260,16 @@ main() { # {{{
&& exit 0 && exit 0
## }}} ## }}}
## If SGE flag files already exists {{{
### Check if APT package upgrade is available
### Create APT temp file
### AND Exit
is_file_present "${sge_queue_flag_pattern}" \
&& is_apt_upgrade_present \
&& touch "${APT_TMP_FILE}" && echo "APT upgrade is available." >> "${APT_TMP_FILE}" \
&& exit 0
## }}}
## If EMPTY_ONLY_MODE is set {{{ ## If EMPTY_ONLY_MODE is set {{{
### Verify empty slots ### Verify empty slots
### OR Exit ### OR Exit
@ -265,7 +282,7 @@ main() { # {{{
## }}} ## }}}
## If APT package upgrade is available {{{ ## If APT package upgrade is available {{{
### Create a temp file ### Create APT temp file
### Disable SGE queue ### Disable SGE queue
### AND Exit ### AND Exit
is_apt_upgrade_present \ is_apt_upgrade_present \