Gentoo Archives: gentoo-user

From: Rich Freeman <rich0@g.o>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Bug in run-crons?
Date: Sun, 12 Dec 2021 18:41:54
Message-Id: CAGfcS_==3kkTFRVG1=01z7vP7rfuSca_nyNJ8WpW8tDz_zM7GA@mail.gmail.com
In Reply to: [gentoo-user] Bug in run-crons? by Frank Steinmetzger
1 On Sun, Dec 12, 2021 at 1:21 PM Frank Steinmetzger <Warp_7@×××.de> wrote:
2 >
3 > It uses state files in /var/spool/cron/lastrun/ to know when each interval
4 > was last run, so it only runs once per period. But: the age threshold for
5 > the state file is period + 5 minutes. Shouldn’t that be period - 5 minutes?
6 >
7 > My reasoning: assume run-crons is run hourly, at the 0 minute sharp. So at
8 > the next run, the state file is exactly one hour old. Since this is not old
9 > enough for the check, run-crons thinks that the last run is too recent and
10 > ignores this period. As a result, each period is only run on every other
11 > iteration.
12
13 I don't use this, but I believe there should be an hourly crontab
14 entry that deletes the cron.hourly file, which would mean it gets run
15 on the next 10min cycle (or maybe sooner - I'm not sure if those jobs
16 are run in parallel or serial).
17
18 The overall result is that things will get run at traditional crontab
19 times no matter what, but if those are missed and enough time is
20 accrued then run-crons will catch this and run the job on the next
21 10min cycle, such as a missed daily overnight slot.
22
23 So if you don't have your computer on a 3AM then the job will get run
24 a bit more than 24h after the last time it was run. Then if you leave
25 it on overnight that night it will run at 3AM despite it not being
26 24h, but at that point if you leave it on it will run at 3AM daily
27 since it will no longer be missed. The fixed times serve to anchor
28 the actual execution times if you do leave the computer on.
29
30 --
31 Rich

Replies

Subject Author
Re: [gentoo-user] Bug in run-crons? Frank Steinmetzger <Warp_7@×××.de>