[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: What does 'apt' in /etc/cron.daily do?



Curt <curty@free.fr> writes:

> On 2013-10-06, Bob Proulx <bob@proulx.com> wrote:
>>
>> I think that comment was basically that /etc/cron.daily/apt doesn't
>> have anything to do with log rotation.  So you are barking up the
>> wrong tree.
>
> Maybe he thought that given the apt script is run before the logrotate
> script in cron.daily (if indeed they're handled in alphabetical order?
> (apparently, yes, they're run in 'lexical sort order' order according to
> the run-parts man page)), if the apt script hung for any reason, the
> logrotate script would never get past the bottleneck, thus "explaining"
> his problem.

Thank you.  Although poorly expressed, that was my reasoning. But it
turns out, although apt does take a long time.... it does finish and
eventually the /etc/cron.daily/logrotate gets fired.  Sooooo, 
apparently that is not the problem.

> Or maybe I should just wait for him to reveal his reasoning, if he ever
> does.

Further testing... first take anacron out of play as BobP suggests.
I removed the the anacron part of the line in /etc/crontab 
original(except dates) :

   47 22  * * *	 root	test -x /usr/sbin/anacron || 
        ( cd / && run-parts --report /etc/cron.daily

edited:

  47 22  * * *	root   cd / && run-parts --report /etc/cron.daily
        
And then adjusted the time to be able to watch the test.

Although there is a hefty pause for the `apt' script, it finishes and
logs are rotated, not what I thought was happening.

So it seems to indicate that anacron is the problem.... but no,
there's more.

Then I switched the /etc/crontab line again so that anacron was the
only thing on it.  And, well, once again hefty pause for `apt' script
but logs are rotated.

OK, so my problem is solved.... I have no idea what I did to `fix' it,
but it was totally accidental whatever it was.

Rotation is apparently working as it should.

Thank you all for the input and patience.

One final question: I decided to rename the /etc/cron.daily/logrotate
script to /etc/cron.daily/00logrotate, so that it runs first.  Just in
case what ever caused my problem ... comes up again.  At least
00logrotate will have the best chance of getting run.

Can anyone think of any problems that renaming step might cause? I
mean other than it might get overwritten, sometime in the future, back
to the default setup and so would possibly need maintenance.

Of course there are other ways, like removing the
/etc/cron.daily/logrotate script altogether and running logrotate
from roots' crontab.


Reply to: