Re: Once again about anacron cron cron.daily
Bob Proulx <bob@proulx.com> writes:
> Harry Putnam wrote:
>> I'm still not getting the whole picture of what is supposed to happen
>> on a machine with both anacron and cron installed.
>
> And you might be tired of having me respond about it. :-)
Not on your life! I have a certain fondness for descriptive and very
helpful posts here.
>> I have lines like the one below in /etc/crontab
>>
>> [...] test -x /usr/sbin/anacron || ( cd / && run-parts --report
>> /etc/cron.daily )
>>
>> Ok, it tests for the presence of /usr/sbin/anacron, checks that it is
>> executable and sees to it that this user has permission to run it.
>
> Yes. The "this user" part is part that you trimmed off. It runs as
> the root user. The root user will always have permission. Let me
> show the part you trimmed off. (Times might be different.)
I was trying to say... I 'got' all that. But I think your formulation
is a bit off. test -x doesn't care who is running what... it checks
to see that the soul calling test -x has permission to run the app it
is called against... at least, that was my reading of `man test'.
But yes, in our subject case it is expected to be root..
>From `man test'
-x FILE
FILE exists and execute (or search) permission is granted
[...]
>> But where and when does anacron actually get called to run?
>> That line appears to expect anacron to be called somewhere else.
>
> Yes. The anacron itself is actually called from ... cron! :-)
>
> $ dpkg -L anacron
> /etc/cron.d/anacron
> ...
Bingo, thank you sir... now it starts to make sense... and thanks too
for pointing out what I should have thought of as a way to get a clue
using `dpkg -L'.
And just a small supplement to help you understand why I didn't quite
follow the setup... On the first sign of trouble with logs not getting
processed, I checked what state anacron was in with
`/etc/init.d/anacron status', which gave a blank <no reply> which made
me assume, (apparently wrongly) that anacron was not running.
So, I started thinking it was not getting called.
[...]
> "/etc/init.d/anacron start". Why invoke-rc.d? Because the local
> admin may have set up a policy-rc.d configuration that disables it.
I was just wondering why `invoke-rc.d', now I get that too, thanks.
[...]
>> I've never taken any actions on anacron and don't remember even
>> installing it purposely... so am I supposed to put it into a run
>> level?
> I can't believe I didn't recommend to you at some previous time that
> you should probably just remove anacron. Do you need it? If not then
> remove it. (I would 'purge' it and remove the config files too.)
You did, on the very first response to slightly different subject but
still involving `cron' and `anacron', might have been on the emacs
list though.
And about needing anacron. Yes, I guess I'm just the type of user that
anacron was designed for. My machine is shut off nearly every day, and
sometimes isn't started for a day or two. When it is, there is no
rigid pattern time wise.
Seems like, if not anacron then I'd need to be a lot more trick and
careful with cron scheduling or do some scripting or the like.
[...]
>> Or, does it get called somewhere else in the cron setup?
>
> Yes! You have guessed it.
>
> Also there is apm support. When power is plugged in and unplugged
> then anacron is run or stopped.
>
Interesting... and good to know. It doesn't effect me at the moment
but at some point I will probably have debian running on a laptop.
Oh, and I hope you do not tire of answering my often poorly worded
queries.
Reply to: