Disable queue if pending upgrade for more than 3 days
This commit is contained in:
parent
d79c9fe833
commit
7f8947dac9
|
@ -139,17 +139,43 @@ is_sge_slots_more_than_percentage() { # {{{
|
||||||
## Used slots is greater or equal than expected percentage
|
## Used slots is greater or equal than expected percentage
|
||||||
return_sge_slots_percentage="0"
|
return_sge_slots_percentage="0"
|
||||||
## Simple debug message to valid current variable
|
## Simple debug message to valid current variable
|
||||||
debug_message "is_sge_slots_more_than_percentage (${local_percentage}%) − \
|
debug_message "is_sge_slots_more_than_percentage − \
|
||||||
Used slots has reached ${local_percentage}% of total slots: ${RED}${local_sge_slots_used:=/dev/null}${COLOR_DEBUG}/${local_sge_slots}."
|
Used slots has reached ${RED}${local_percentage}%${COLOR_DEBUG} of total slots: ${RED}${local_sge_slots_used:=/dev/null}${COLOR_DEBUG}/${local_sge_slots}."
|
||||||
else
|
else
|
||||||
return_sge_slots_percentage="1"
|
return_sge_slots_percentage="1"
|
||||||
## Simple debug message to valid current variable
|
## Simple debug message to valid current variable
|
||||||
debug_message "is_sge_slots_more_than_percentage (${local_percentage}%) − \
|
debug_message "is_sge_slots_more_than_percentage − \
|
||||||
Used slots did not reach ${local_percentage}% of total slots: ${RED}${local_sge_slots_used:=/dev/null}${COLOR_DEBUG}/${local_sge_slots}."
|
Used slots did not reach ${RED}${local_percentage}%${COLOR_DEBUG} of total slots: ${RED}${local_sge_slots_used:=/dev/null}${COLOR_DEBUG}/${local_sge_slots}."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
return "${return_sge_slots_percentage}"
|
return "${return_sge_slots_percentage}"
|
||||||
|
|
||||||
|
}
|
||||||
|
# }}}
|
||||||
|
is_pending_upgrade_more_than_days() { # {{{
|
||||||
|
|
||||||
|
local_days="${1}"
|
||||||
|
|
||||||
|
local_line_size="24"
|
||||||
|
|
||||||
|
local_max_file_size="$(( ${local_days} * ${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)."
|
||||||
|
|
||||||
|
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."
|
||||||
|
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."
|
||||||
|
fi
|
||||||
|
|
||||||
|
return "${return_pending_upgrade_more_than_days}"
|
||||||
|
|
||||||
}
|
}
|
||||||
# }}}
|
# }}}
|
||||||
is_sge_slots_empty() { # {{{
|
is_sge_slots_empty() { # {{{
|
||||||
|
@ -224,6 +250,17 @@ main() { # {{{
|
||||||
&& exit 0
|
&& exit 0
|
||||||
## }}}
|
## }}}
|
||||||
|
|
||||||
|
## If pending upgrade since 3~4 days AND {{{
|
||||||
|
## APT package upgrade is available
|
||||||
|
### Create a temp file
|
||||||
|
### Disable SGE queue
|
||||||
|
is_pending_upgrade_more_than_days "3" \
|
||||||
|
&& is_apt_upgrade_present \
|
||||||
|
&& touch "${APT_TMP_FILE}" && echo "APT upgrade is available." >> "${APT_TMP_FILE}" \
|
||||||
|
&& sh "${sge_disable_host_queue_script}" \
|
||||||
|
&& exit 0
|
||||||
|
## }}}
|
||||||
|
|
||||||
## If SGE used slots is NULL AND {{{
|
## If SGE used slots is NULL AND {{{
|
||||||
## APT package upgrade is available
|
## APT package upgrade is available
|
||||||
### Create a temp file
|
### Create a temp file
|
||||||
|
|
Loading…
Reference in New Issue