From: Frank Steinmetzger <Warp_7@gmx.de>
To: gentoo-user@lists.gentoo.org
Subject: Re: [gentoo-user] Bug in run-crons?
Date: Sun, 12 Dec 2021 20:07:49 +0100 [thread overview]
Message-ID: <YbZIhcaZCHqjPCbN@kern> (raw)
In-Reply-To: <CAGfcS_==3kkTFRVG1=01z7vP7rfuSca_nyNJ8WpW8tDz_zM7GA@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1737 bytes --]
Am Sun, Dec 12, 2021 at 01:41:33PM -0500 schrieb Rich Freeman:
> On Sun, Dec 12, 2021 at 1:21 PM Frank Steinmetzger <Warp_7@gmx.de> wrote:
> >
> > It uses state files in /var/spool/cron/lastrun/ to know when each interval
> > was last run, so it only runs once per period. But: the age threshold for
> > the state file is period + 5 minutes. Shouldn’t that be period - 5 minutes?
> >
> > My reasoning: assume run-crons is run hourly, at the 0 minute sharp. So at
> > the next run, the state file is exactly one hour old. Since this is not old
> > enough for the check, run-crons thinks that the last run is too recent and
> > ignores this period. As a result, each period is only run on every other
> > iteration.
>
> I don't use this, but I believe there should be an hourly crontab
> entry that deletes the cron.hourly file, which would mean it gets run
> on the next 10min cycle (or maybe sooner - I'm not sure if those jobs
> are run in parallel or serial).
The check that I mentioned above is actually the deletion which you mention:
run-crons looks for the state file for the given interval and - if it is old
enough - deletes it.
The part that executes the individual cron scripts is only executed if there
is no state file. The first thing it then does is to create a new state file.
In pseudo code:
1. look for period state file that is older than interval + 5 mins
found one?
delete it
2. Look for period state file
none found?
create state file
execute cron scripts for that interval
--
Grüße | Greetings | Qapla’
Please do not share anything from, with or about me on any social network.
The boss is a human just like everyone else, he just doesn’t know.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2021-12-12 19:08 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-12 18:21 [gentoo-user] Bug in run-crons? Frank Steinmetzger
2021-12-12 18:41 ` Rich Freeman
2021-12-12 19:07 ` Frank Steinmetzger [this message]
2021-12-13 20:18 ` Rich Freeman
2021-12-13 21:19 ` Frank Steinmetzger
2021-12-13 21:33 ` Michael Orlitzky
2021-12-13 21:38 ` Frank Steinmetzger
2021-12-13 21:42 ` Michael Orlitzky
2021-12-13 21:54 ` Rich Freeman
2021-12-13 22:03 ` Frank Steinmetzger
2021-12-13 22:26 ` Wols Lists
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YbZIhcaZCHqjPCbN@kern \
--to=warp_7@gmx.de \
--cc=gentoo-user@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox