Am Sun, Dec 12, 2021 at 01:41:33PM -0500 schrieb Rich Freeman:
> On Sun, Dec 12, 2021 at 1:21 PM Frank Steinmetzger <war...@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: signature.asc
Description: PGP signature

Reply via email to