why there is anacron and atd?

Asked by Shannon Fang

In Ubuntu there are 2 "schedulers", anacron and atd. Why we need two? I some time need to write some backup scripts and schedule them by using crontab, please tell me what is the "backend" program which interpret user's crontab files? Can I disable anacron or atd? If not what programs are dependant on these 2?

Thanks a lot!

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
Sébastien Corriveau
Solved:
Last query:
Last reply:
Revision history for this message
Sébastien Corriveau (sebcor-deactivatedaccount) said :
#1

"anacron" runs program periodically at specifiy interval. It is useful for scheduling your every night backups.

"atd" will run your program once at the desired time. You can useful to force a one time reboot in the middle of the night when your server's kernel have just been upgraded.

> please tell me what is the "backend" program which interpret user's crontab files?

Unless I misunderstood your question the answer is "cron".

> Can I disable anacron or atd?

Yes, you can disable either of them (or both) by going into the following top panel menu: "System" -> "Administration" -> "Services"

Revision history for this message
Shannon Fang (xrfang) said :
#2

Hi Sebastien,

Thanks for your explanation. I think cron is "better" than atd for me, but I am still not 100% clear:

1) you mean, beside anacron, there is a process called "cron" on my system that read "crontab"? i.e. anacron is COMPLETELY not necessary? (or it is just a improved version of cron? if there are two "cron" program on my system, how do I disable the "default" or "classic" cron and let anacron read my crontab (if anacron is by all means better than "classic" cron)??

2) by saying "can I disable them", I of course know I can and I know how to do so. My question is, are there any known application relying on these 2 services. The most notably example is, if I disable anacron will my cron tasks still be executed?

Thanks!
Shannon

Revision history for this message
Shannon Fang (xrfang) said :
#3

also, another related question. If I disabled "atd", but later execute the command "at", will "at" report that "atd" is disabled immediately when I use "at", or it just silently ignore my commands (same for cron)?

Thanks,
Shannon

Revision history for this message
Best Sébastien Corriveau (sebcor-deactivatedaccount) said :
#4

anacron is not a daemon itself but more of a companion for the cron daemon. It is useful on systems that are not running 24/7. If your computer is turned off, cron won't be able to run your scheduled jobs on time and won't try to run them later. anacron fills that hole by making sure that your missed scheduled jobs will be run eventually.

If you disable anacron, your cron jobs will still be executed, but only if the computer is running at the specified time.

> If I disabled "atd", but later execute the command "at", will "at" report that "atd" is disabled immediately when I use "at", or it just silently ignore my commands (same for cron)?

If no "atd" process is running, "at" will still add the job to the job queue but will gives you this warning: "Can't open /var/run/atd.pid to signal atd. No atd running?". I just tried with cron and it looks like there's not warning when no cron daemon is running.

Revision history for this message
Shannon Fang (xrfang) said :
#5

Thanks Sébastien Corriveau, that solved my question.