[CentOS] crontab and/or anacrontab ?

Stephen Harris lists at spuddy.org
Thu Mar 11 18:37:15 UTC 2010


On Thu, Mar 11, 2010 at 04:52:56PM +0000, Tony Molloy wrote:
> It's only on if you have switched it on..
> #  chkconfig --list | grep anacron

> #  chkconfig --level 35 anacon off
> 
> will switch it off. on next rebot
> 
> #  service anacron stop
> 
> will stop it immediatley.

In fact, it's not that simple; anacron isn't a persistent daemon.

The way it works is that the rc script calls anacron to catch up on
missed jobs.  When anacron has finished this then it exits.

Now from regular cron you'll see /etc/cron.{daily,weekly,monthly}/0anacron
which calls "anacron -u".  This simply tells anacron to update the
timestamp and does nothing else.

And that's how the boot version determines if there's work to do; if the
timestamp file is too old at boot time.

During normal operation anacron shouldn't run (except for the timestamp
updates).  If it is then either it's been running since boot time
(lots of work to catchup?  hung?) or else it's been incorrectly started.

So
$ chkconfig --list anacron
anacron         0:off   1:off   2:on    3:on    4:on    5:on    6:off

$ service anacron status
anacron is stopped

$ grep anacron /var/log/cron
Mar  7 04:22:02 mercury anacron[3138]: Updated timestamp for job `cron.weekly' to 2010-03-07
Mar  8 04:02:02 mercury anacron[20530]: Updated timestamp for job `cron.daily' to 2010-03-08
Mar  9 04:02:02 mercury anacron[26657]: Updated timestamp for job `cron.daily' to 2010-03-09
Mar 10 04:02:03 mercury anacron[5804]: Updated timestamp for job `cron.daily' to 2010-03-10
Mar 11 04:02:01 mercury anacron[10005]: Updated timestamp for job `cron.daily' to 2010-03-11


-- 

rgds
Stephen



More information about the CentOS mailing list