Mailinglist Archive: opensuse (3666 mails)

< Previous Next >
Re: [SLE] cron.daily
  • From: "Carlos E. R." <robin1.listas@xxxxxxxxxx>
  • Date: Sat, 5 Mar 2005 03:26:32 +0100 (CET)
  • Message-id: <Pine.LNX.4.58.0503050309110.7178@xxxxxxxxxxxxxxxx>

The Friday 2005-03-04 at 13:46 +0100, Anders Johansson wrote:

> On Friday 04 March 2005 13:33, Richard Bos wrote:
> > Does anyone know when the scripts in /etc/cron.daily are being executed?
> > It is of course once a day, but just when. Are the scripts examined every
> > minuted by /usr/bin/cron? If so does it mean that the scripts
> > in /etc/cron.daily could be executed just after booting? Just wondering.
> Have a look at /etc/crontab, that's where it's run from.
> so it gets run at 4.15 in the morning

Actually, it is a bit more complex than that :-)

The first line found in crontab is:

-*/15 * * * * root test -x /usr/lib/cron/run-crons && /usr/lib/cron/run-crons >/dev/null 2>&1

The main script gets run every 15 minutes. Then, it does some math to see
when each section (hourly, daily, etc) was run - and if the proper
interval has passed, all the scripts in the corresponding directory are

59 * * * * root rm -f /var/spool/cron/lastrun/cron.hourly
14 4 * * * root rm -f /var/spool/cron/lastrun/cron.daily
29 4 * * 6 root rm -f /var/spool/cron/lastrun/cron.weekly
44 4 1 * * root rm -f /var/spool/cron/lastrun/cron.monthly

This ensures that each flag file is deleted, if the machine is running at
that time. For example, the hourly flag is deleted at the 59th minute of
each hour; the daily at 4:14, the weekly at 4:29, the monthly at 4:44...

Those will be the hours they run, I think, if the machine is on
continuously - well, when the next 15 minutes interval completes, I think.

If the machine is not on 24*7, the run-crons script runs 15 minutes after
booting. The daily section will run then if it hasn't run in the previous
24 hours, and then again sometime after 4:14 if it still on ... or
something of the sort, I'm to sleepy to think. I'm off! O:-)

Carlos Robinson

< Previous Next >
Follow Ups