Control: severity -1 wishlist
Control: tags -1 + moreinfo

On Thu, 25 Jul 2019 12:51:03 -0400 Anthony DeRobertis wrote:

> Package: apt-listbugs
> Version: 0.1.30
> Severity: minor
> File: /lib/systemd/system/apt-listbugs.timer

Hello Anthony,
nice to read you! Thanks for your bug report.

> 
> I noticed in my logs that systemd is running "Daily apt-listbugs
> preferences cleanup" once per hour, which of course looks like a bug.

Well, it may *look* like a bug, but, actually, it is intentional!

> 
> It seems like what is actually happening is the timer fires hourly and
> then the script that is ultimately run has some logic to check if its
> been a day or not. I imagine this is for cron compatability (I guess on
> systems without anacron?)...

It all began when lintian suggested me to create a systemd timer to
replace the cron job on boxes using systemd as PID 1, see bug [#928041].

[#928041]: <https://bugs.debian.org/928041>

Since there seems to be no "official" recommended way to create systemd
timers equivalent to cron jobs, I had to cook my own solution.
The current implementation has been developed with a fair amount of
thinking and experimentation.

I am open to suggestions on how to improve/simplify the timer, but
please take into account that there are multiple requirements to meet:

 • the cleaning script should be run similarly on machines with systemd
   as PID 1 and on machines with other init systems (such as sysvinit):
   this means that the timer should run the cleaning script in a way
   similar to a cron.daily job executed by cron or anacron

   → at most once a day

   → catching up missed executions, if the machine is not always up and
     running

   → early in the morning, if the machine is up and running at that time

   → sending the output to root via local mail, if any output is
     produced

 • the cleaning script run should be attempted when the Internet link
   is on and working, if possible (in order to allow apt-listbugs to
   talk to the Debian BTS)

> 
> systemd timers can just do all that, though, with the Persistent=
> option.

I tried the Persistent=true option multiple times: the main problem
with a Persistent=true daily timer is that the catch up happens
immediately after the timer is reactivated.
This can mean that the Internet link is not yet on and working (imagine
a laptop which is booted once a day or less and is not immediately
online, because the user has to log in and connect to a wireless
LAN...) and we miss the only chance to correctly do the cleaning!

Please note that "After=network.target network-online.target" does not
seem to actually guarantee that the Internet link is on and working,
when the catch up happens.

> That'd have a couple advantages, like being easier for the admin
> to understand, easier to customize (e.g., maybe 7am isn't a good time),
> and I suppose probably save a barely measurable amount of electricity.

Please note that anacron also fires up hourly (on machines with systemd
as PID 1) to check whether the daily jobs are to be run or have already
been completed: /lib/systemd/system/anacron.timer

> 
> Anyway, I'm filing this as minor, but feel free to downgrade to
> wishlist.

Done.

> Though I suggest striking the word "daily" in the timer
> Description= if you do.

Which description would you suggest for an apt-listbugs preferences
cleanup activity which is *attempted* hourly (as well as once after each
boot), but *run* at most once a day?

I honestly thought that "Daily apt-listbugs preferences cleanup" could
fit, but I am not an English native speaker, and I would be happy to
get a suggestion for a better wording.


Thanks for your interest in improving apt-listbugs!

-- 
 http://www.inventati.org/frx/
 There's not a second to spare! To the laboratory!
..................................................... Francesco Poli .
 GnuPG key fpr == CA01 1147 9CD2 EFDF FB82  3925 3E1C 27E1 1F69 BFFE

Attachment: pgpwoQzuZ_Yhu.pgp
Description: PGP signature

Reply via email to