Rename days to attempts
If we run X times the script with available upgrade, the SGE queue will be disabled.
This commit is contained in:
parent
a18bd2cb96
commit
fbe10bda8f
|
@ -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_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}) − \
|
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_days} days * ${local_line_size} bytes size for one line)."
|
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
|
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
|
## Temp file seems to exist for more than the maximum attempts
|
||||||
return_pending_upgrade_more_than_days="0"
|
return_pending_upgrade_more_than_attempts="0"
|
||||||
debug_message "is_pending_upgrade_more_than_days − \
|
debug_message "is_pending_upgrade_more_than_attempts − \
|
||||||
There is pending upgrade(s) for more than ${RED}${local_days:=/dev/null}${COLOR_DEBUG} days."
|
There is pending upgrade(s) for more than ${RED}${local_attempts:=/dev/null}${COLOR_DEBUG} attempts."
|
||||||
else
|
else
|
||||||
return_pending_upgrade_more_than_days="1"
|
return_pending_upgrade_more_than_attempts="1"
|
||||||
debug_message "is_pending_upgrade_more_than_days − \
|
debug_message "is_pending_upgrade_more_than_attempts − \
|
||||||
NO pending upgrades for more than ${RED}${local_days:=/dev/null}${COLOR_DEBUG} days."
|
NO pending upgrades for more than ${RED}${local_attempts:=/dev/null}${COLOR_DEBUG} attempts."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
return "${return_pending_upgrade_more_than_days}"
|
return "${return_pending_upgrade_more_than_attempts}"
|
||||||
|
|
||||||
}
|
}
|
||||||
# }}}
|
# }}}
|
||||||
|
@ -248,11 +248,11 @@ main() { # {{{
|
||||||
&& exit 0
|
&& exit 0
|
||||||
## }}}
|
## }}}
|
||||||
|
|
||||||
## If pending upgrade since 3~4 days {{{
|
## If pending upgrade since 3 attempts {{{
|
||||||
## APT package upgrade is available
|
## APT package upgrade is available
|
||||||
### Create a temp file
|
### Create a temp file
|
||||||
### Disable SGE queue
|
### 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}" \
|
&& touch "${APT_TMP_FILE}" && echo "APT upgrade is available." >> "${APT_TMP_FILE}" \
|
||||||
&& sh "${sge_disable_host_queue_script}" \
|
&& sh "${sge_disable_host_queue_script}" \
|
||||||
&& exit 0
|
&& exit 0
|
||||||
|
|
Loading…
Reference in New Issue