Fix evoqa #3623: custom limit for IS_NOTUPGRADED

Set higher time limit for servers not being part of the regular upgrade
process:
  - if mails are sent to listupgrade-todo@
  - or if listupgrade.sh is not executed on a weekly basis.
This commit is contained in:
Romain Dessort 2018-03-23 15:36:45 -04:00
parent 76575e9fb1
commit 92b18e201c

View file

@ -519,7 +519,14 @@ if [ -e /etc/debian_version ]; then
# Check if no package has been upgraded since $limit.
if [ "$IS_NOTUPGRADED" = 1 ]; then
last_upgrade=$(date +%s -d $(zgrep -h upgrade /var/log/dpkg.log* |sort -n |tail -1 |cut -f1 -d ' '))
limit=$(date +%s -d "now - 90 days")
if grep -q '^mailto="listupgrade-todo@' /etc/evolinux/listupgrade.cnf \
|| grep -q -E '^[[:digit:]]+[[:space:]]+[[:digit:]]+[[:space:]]+[^\*]' /etc/cron.d/listupgrade; then
# Manual upgrade process
limit=$(date +%s -d "now - 180 days")
else
# Regular process
limit=$(date +%s -d "now - 90 days")
fi
if [ -f /var/log/evolinux/00_prepare_system.log ]; then
install_date=$(stat -c %Z /var/log/evolinux/00_prepare_system.log)
else