#2 95-hwe-eol / update-motd-hwe-eol

Sadly this already does some caching in update-motd-hwe-eol by checking
if the last of these checks is older than an update to the source lists.
But to do so it has already executed the - relatively - rather expensive
apt-config calls.

Since it comes down to checking new sources.lists there is no need to
update this more often than once every few minutes or hours. Could be
even slower without loosing most of its value, but we already achieve
most of what we need with a delay of ~1h.

We started with:
     5.37%  apt-config
Now:
     -- no more present


--- orig/95-hwe-eol     2022-03-30 07:53:18.396529018 +0000
+++ /etc/update-motd.d/95-hwe-eol       2022-03-30 09:13:16.160985148 +0000
@@ -1,5 +1,11 @@
 #!/bin/sh
 
+# this stamp is created and updated by 
/usr/lib/update-notifier/update-motd-hwe-eol
+stamp="/var/lib/update-notifier/hwe-eol"
+
+# do not try to refresh this more than once per hour
+find $stamp -newermt 'now-1 hours' 2> /dev/null | grep -m 1 '.' && exit 0
+
 if [ -x /usr/lib/update-notifier/update-motd-hwe-eol ]; then
     exec /usr/lib/update-notifier/update-motd-hwe-eol
 fi


No big need left to reduce the apt-config usage in update-motd-hwe-eol after 
this change.

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1893716

Title:
  scripts in /etc/update-motd.d/ run even on login via non-interactive
  scp and sftp sessions

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/landscape-client/+bug/1893716/+subscriptions


-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to