See below. On Sun, May 2, 2021 at 11:08 AM Francesco Poli <invernom...@paranoici.org> wrote: > > On Sat, 1 May 2021 11:31:19 -0700 Ross Boylan wrote: > > [...] > > On Fri, Apr 30, 2021 at 2:47 PM Francesco Poli > > <invernom...@paranoici.org> wrote: > [...] > > > Does logcheck send e-mail messages for all the other systemd timers? > > > > > > As you may already know, you can get a list of active systemd timers on > > > your box with the following command: > > > > > > $ systemctl list-timers > > > > > Thanks for the tip; I wasn't familiar with list-timers. There are 11 > > on my list, but the only things I see in my hourly reports from > > logcheck were apt-listbugs and complaints about time synchronization. > > Do you have anacron installed?
Yes. > It's another package that has an hourly systemd timer. > > I wonder why logcheck does not send hourly mail messages about > anacron... > For logcheck to send a message there must be something in the logs it checks and it must either match a pattern logcheck thinks is noteworthy or (from memory) fail to match a pattern for things that are OK. I haven't reviewed exactly why the messages are being noted, albeit at logcheck's lowest severity level. I configured logcheck to use workstation mode. > > Of course, I don't know how many of the timers are hourly. > > The command 'systemctl list-timers' should tell you: just look at the > LEFT and PASSED columns. Sun 02 May 2021 01:19:46 PM PDT NEXT LEFT LAST PASSED UNIT ACTIVATES Sun 2021-05-02 13:30:14 PDT 10min left Sun 2021-05-02 12:31:06 PDT 48min ago anacron.timer anacron.service Sun 2021-05-02 22:56:18 PDT 9h left Sun 2021-05-02 12:50:06 PDT 29min ago apt-daily.timer apt-daily.service Mon 2021-05-03 00:00:00 PDT 10h left Sun 2021-05-02 00:00:01 PDT 13h ago exim4-base.timer exim4-base.service Mon 2021-05-03 00:00:00 PDT 10h left Sun 2021-05-02 00:00:01 PDT 13h ago logrotate.timer logrotate.service Mon 2021-05-03 00:00:00 PDT 10h left Sun 2021-05-02 00:00:01 PDT 13h ago man-db.timer man-db.service Mon 2021-05-03 01:25:15 PDT 12h left Mon 2021-04-26 16:32:27 PDT 5 days ago fstrim.timer fstrim.service Mon 2021-05-03 06:45:23 PDT 17h left Sun 2021-05-02 06:28:28 PDT 6h ago apt-daily-upgrade.timer apt-daily-upgrade.service Mon 2021-05-03 10:05:28 PDT 20h left Sun 2021-05-02 10:05:28 PDT 3h 14min ago etckeeper.timer etckeeper.service Mon 2021-05-03 10:05:28 PDT 20h left Sun 2021-05-02 10:05:28 PDT 3h 14min ago systemd-tmpfiles-clean.timer systemd-tmpfiles-clean.serv… Mon 2021-05-03 11:42:24 PDT 22h left Sun 2021-05-02 11:50:28 PDT 1h 29min ago apt-listbugs.timer apt-listbugs.service Sun 2021-05-09 03:10:37 PDT 6 days left Sun 2021-05-02 03:11:06 PDT 10h ago e2scrub_all.timer e2scrub_all.service So it looks as if anacron is the only one that is running hourly. apt-listbugs would too if I hadn't messed with it. Let's see how apt-daily-upgrade works: =========================apt-daily-upgrade.timer============================== [Unit] Description=Daily apt upgrade and clean activities After=apt-daily.timer [Timer] OnCalendar=*-*-* 6:00 RandomizedDelaySec=60m Persistent=true [Install] WantedBy=timers.target =====================apt-daily-upgrade.service===================== [Unit] Description=Daily apt upgrade and clean activities Documentation=man:apt(8) ConditionACPower=true After=apt-daily.service network.target network-online.target systemd-networkd.service NetworkManager.service connman.service [Service] Type=oneshot ExecStartPre=-/usr/lib/apt/apt-helper wait-online ExecStart=/usr/lib/apt/apt.systemd.daily install KillMode=process TimeoutStopSec=900 ================================================= 1. So the timer is 6am every day. 2. Persistent=true means if you restart the system and a timer would have run while it was off, it is run. Got that from https://wiki.archlinux.org/title/Systemd/Timers, though it actually is documented on the man page for systemd.timer. 3. network targets in [Unit] to (try to?) assure connectivity. BTW, for some insight into why the network target doesn't work as expected, see https://www.freedesktop.org/wiki/Software/systemd/NetworkTarget/. I still find it annoying, but I appreciate the point that it is not straightforward to say exactly what the network being "up" means. That seems like a model that could work for apt-listbugs, assuming the script were changed to update unconditionally when invoked. > > Or you could read the timer definitions, if you know (or learn) the > syntax and semantics... > > [...] > > I tried this modification to apt-listbugs.timer: > > [Timer] > > OnActiveSec=5min > > #OnCalendar=*-*-* *:20 > > OnUnitActiveSec=23h 50m > > RandomizedDelaySec=20min > > > > which did fix the "running every hour" problem (even if the run is > > only to check if a real update is necessary). > > But this does not entirely meet the desired behavior expressed in 932995: > [...] > > Not only that, but there's also another issue with this modification. > > The timer would only trigger once every (slightly less than one) day: > if your system is not online during that only attempt, you are out of > luck for another day or so... I think OnActiveSec triggers an initial run 5minutes after system startup. Have I misunderstood the semantics? > > > > > > > > > Another work-around for the visible annoyance would be for me to tell > > > > logcheck to ignore the relevant messages. > > > > > > I think this should be the way to avoid the annoyance. > > > > It avoids the annoyance of seeing the message, but it leaves the job > > firing every hour. > > I think this is needed to have some reasonable chance to get one > successful cleanup operation a day. How about the style of apt-daily-upgrade? > > [...] > > > If you do not object, I will close this bug report. > > > > > I suppose, though, as observed in the other bug you mentioned, the > > message about "daily update" is confusing. The fact that other > > packages aren't exhibiting such behavior suggests there is some other > > way to handle this, but I certainly don't know what it is. > > I am open to suggestions on how to change the Description field for the > timer. > I see that the Description for the anacron timer is "Trigger anacron > every hour": maybe I should think about a Description that uses the > word "hourly", rather than "daily". If sticking with the current setup but changing the message, it currently is Starting Daily apt-listbugs preferences cleanup... (or Finishing ....). Maybe Starting check for daily apt-listbugs preferences cleanup... and/or different messages depending on what happened: Skipping daily apt-listbugs preferences cleanup. Too soon. or Finished run of daily apt-listbugs preferences cleanup. BTW, I don't know what the job is doing, but should it also do it after someone dpkg-reconfigure's apt-listbugs? Ross