What is Anacron?

Anacron is a periodic command scheduler. It executes commands at intervals specified in days. Unlike cron, it does not assume that the system is running continuously. It can therefore be used to control the execution of daily, weekly and monthly jobs (or anything with a period of n days), on systems that don't run 24 hours a day. When installed and configured properly, Anacron will make sure that the commands are run at the specified intervals as closely as machine-uptime permits.

Every time Anacron is run, it reads a configuration file that specifies the jobs Anacron controls, and their periods in days. If a job wasn't executed in the last n days, where n is the period of that job, Anacron executes it. Anacron then records the date in a special timestamp file that it keeps for each job, so it can know when to run it again. When all the executed commands terminate, Anacron exits.

Why may Anacron be useful?

Most Unix-like systems have daily, weekly and monthly scripts that take care of various "housekeeping chores" such as log-rotation, updating the "locate" and "man" databases, etc. Daily scripts are usually scheduled as cron-jobs to execute around 1-7 AM. Weekly scripts are scheduled to run on Sundays. On machines that are turned off for the night or for the weekend, these scripts rarely get run.

Anacron solves this problem. These jobs can simply be scheduled as Anacron-jobs with periods of 1, 7 and 30 days.

Anacron is especially intended for laptop users and for people who only turn their computer on for a few hours a day.

What is Anacron not?

Anacron is not an attempt to make cron redundant. It cannot be used to schedule commands at intervals smaller than days. It also does not guarantee that the commands will be executed at any specific day or hour.

It isn't a full-time daemon. It has to be executed from boot scripts, from cron-jobs, or explicitly.