From fbe10bda8fac022bca014f93156b48e2e53c2d1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gardais=20J=C3=A9r=C3=A9my?= Date: Mon, 30 Nov 2020 14:45:23 +0100 Subject: [PATCH] Rename days to attempts If we run X times the script with available upgrade, the SGE queue will be disabled. --- cluster/apt.check.update.sh | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/cluster/apt.check.update.sh b/cluster/apt.check.update.sh index adf3518..bb80ccb 100755 --- a/cluster/apt.check.update.sh +++ b/cluster/apt.check.update.sh @@ -155,29 +155,29 @@ Used slots did not reach ${RED}${local_percentage}%${COLOR_DEBUG} of total slots } # }}} -is_pending_upgrade_more_than_days() { # {{{ +is_pending_upgrade_more_than_attempts() { # {{{ - local_days="${1}" + local_attempts="${1}" local_line_size="24" - local_max_file_size="$(( ${local_days} * ${local_line_size} ))" + local_max_file_size="$(( ${local_attempts} * ${local_line_size} ))" - debug_message "is_pending_upgrade_more_than_days (${local_days}) − \ -Check if ${APT_TMP_FILE} has a size bigger than ${RED}${local_max_file_size:=/dev/null}${COLOR_DEBUG} bytes (${local_days} days * ${local_line_size} bytes size for one line)." + debug_message "is_pending_upgrade_more_than_attempts (${local_attempts}) − \ +Check if ${APT_TMP_FILE} has a size bigger than ${RED}${local_max_file_size:=/dev/null}${COLOR_DEBUG} bytes (${local_attempts} attempts * ${local_line_size} bytes size for one line)." if [ $(find "${APT_TMP_FILE}" -type f -size +"${local_max_file_size}"c 2>/dev/null) ]; then - ## Temp file seems to exist for more than the maximum days - return_pending_upgrade_more_than_days="0" - debug_message "is_pending_upgrade_more_than_days − \ -There is pending upgrade(s) for more than ${RED}${local_days:=/dev/null}${COLOR_DEBUG} days." + ## Temp file seems to exist for more than the maximum attempts + return_pending_upgrade_more_than_attempts="0" + debug_message "is_pending_upgrade_more_than_attempts − \ +There is pending upgrade(s) for more than ${RED}${local_attempts:=/dev/null}${COLOR_DEBUG} attempts." else - return_pending_upgrade_more_than_days="1" - debug_message "is_pending_upgrade_more_than_days − \ -NO pending upgrades for more than ${RED}${local_days:=/dev/null}${COLOR_DEBUG} days." + return_pending_upgrade_more_than_attempts="1" + debug_message "is_pending_upgrade_more_than_attempts − \ +NO pending upgrades for more than ${RED}${local_attempts:=/dev/null}${COLOR_DEBUG} attempts." fi - return "${return_pending_upgrade_more_than_days}" + return "${return_pending_upgrade_more_than_attempts}" } # }}} @@ -248,11 +248,11 @@ main() { # {{{ && exit 0 ## }}} - ## If pending upgrade since 3~4 days {{{ + ## If pending upgrade since 3 attempts {{{ ## APT package upgrade is available ### Create a temp file ### Disable SGE queue - is_pending_upgrade_more_than_days "3" \ + is_pending_upgrade_more_than_attempts "3" \ && touch "${APT_TMP_FILE}" && echo "APT upgrade is available." >> "${APT_TMP_FILE}" \ && sh "${sge_disable_host_queue_script}" \ && exit 0