Mailinglist Archive: opensuse (3666 mails)

< Previous Next >
Re: [SLE] cron.daily
  • From: Ken Schneider <suse-list@xxxxxxxxxxxxx>
  • Date: Fri, 04 Mar 2005 23:22:14 -0500
  • Message-id: <1109996534.27831.10.camel@xxxxxxxxxxxxxxxxx>
On Fri, 2005-03-04 at 21:26, Carlos E. R. wrote:
> 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

NO math is performed, cron runs when instructed.

> when each section (hourly, daily, etc) was run - and if the proper
> interval has passed, all the scripts in the corresponding directory are
> executed.
>
>
> 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.

Wrong. It runs every 15 minutes starting at the top of the hour. If you
boot your machine at 8:10 run-crons will still run at 8:15 -not- at
8:25, 15 minutes after you booted.

> The daily section will run then if it hasn't run in the previous
> 24 hours,

Incorrect it will -only- run at 4:15am if the machine is on. The only
way it will run at some other time is if you shut the machine down after
4:14am, when the daily check file has been deleted and before the 4:15am
run of run-crons.

> 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:-)
>
> --
> Cheers,
> Carlos Robinson
--
Ken Schneider
UNIX since 1989, linux since 1994, SuSE since 1998

* Only reply to the list please*

"The day Microsoft makes something that doesn't suck is probably
the day they start making vacuum cleaners." -Ernst Jan Plugge


< Previous Next >
Follow Ups