Gentoo Archives: gentoo-user

From: Frank Steinmetzger <Warp_7@×××.de>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Bug in run-crons?
Date: Sun, 12 Dec 2021 19:08:13
Message-Id: YbZIhcaZCHqjPCbN@kern
In Reply to: Re: [gentoo-user] Bug in run-crons? by Rich Freeman
1 Am Sun, Dec 12, 2021 at 01:41:33PM -0500 schrieb Rich Freeman:
2 > On Sun, Dec 12, 2021 at 1:21 PM Frank Steinmetzger <Warp_7@×××.de> wrote:
3 > >
4 > > It uses state files in /var/spool/cron/lastrun/ to know when each interval
5 > > was last run, so it only runs once per period. But: the age threshold for
6 > > the state file is period + 5 minutes. Shouldn’t that be period - 5 minutes?
7 > >
8 > > My reasoning: assume run-crons is run hourly, at the 0 minute sharp. So at
9 > > the next run, the state file is exactly one hour old. Since this is not old
10 > > enough for the check, run-crons thinks that the last run is too recent and
11 > > ignores this period. As a result, each period is only run on every other
12 > > iteration.
13 >
14 > I don't use this, but I believe there should be an hourly crontab
15 > entry that deletes the cron.hourly file, which would mean it gets run
16 > on the next 10min cycle (or maybe sooner - I'm not sure if those jobs
17 > are run in parallel or serial).
18
19 The check that I mentioned above is actually the deletion which you mention:
20 run-crons looks for the state file for the given interval and - if it is old
21 enough - deletes it.
22
23 The part that executes the individual cron scripts is only executed if there
24 is no state file. The first thing it then does is to create a new state file.
25
26
27 In pseudo code:
28 1. look for period state file that is older than interval + 5 mins
29 found one?
30 delete it
31
32 2. Look for period state file
33 none found?
34 create state file
35 execute cron scripts for that interval
36
37 --
38 Grüße | Greetings | Qapla’
39 Please do not share anything from, with or about me on any social network.
40
41 The boss is a human just like everyone else, he just doesn’t know.

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies

Subject Author
Re: [gentoo-user] Bug in run-crons? Rich Freeman <rich0@g.o>