8.3 Configuring anacron Jobs

System anacron jobs are defined in /etc/anacrontab, which contains definitions for the SHELL, PATH, MAILTO, RANDOM_DELAY, and START_HOURS_RANGE variables for the environment in which the jobs run, followed by the job definitions themselves. Comment lines start with a # character.

RANDOM_DELAY is the maximum number of random time in minutes that anacron adds to the delay parameter for a job. The default minimum delay is 6 minutes. The random offset is intended to prevent anacron overloading the system with too many jobs at the same time.

START_HOURS_RANGE is the time range of hours during the day when anacron can run scheduled jobs.

Job definitions are specified in the following format:

period  delay  job-id  command

where the fields are:

period

Frequency of job execution specified in days or as @daily, @weekly, or @monthly for once per day, week, or month.

delay

Number of minutes to wait before running a job.

job-id

Unique name for the job in log files.

command

The shell script or command to be run.

The following entries are taken from the default /etc/anacrontab file:

SHELL=/bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
# the maximal random delay added to the base delay of the jobs
RANDOM_DELAY=45
# the jobs will be started during the following hours only
START_HOURS_RANGE=3-22

#period in days  delay in minutes  job-identifier   command
1                5	             cron.daily       nice run-parts /etc/cron.daily
7                25	            cron.weekly      nice run-parts /etc/cron.weekly
@monthly         45	            cron.monthly     nice run-parts /etc/cron.monthly

By default, anacron runs jobs between 03:00 and 22:00 and randomly delays jobs by between 11 and 50 minutes. The job scripts in /etc/cron.daily, run anywhere between 03:11 and 03:50 every day if the system is running, or after the system is booted and the time is less than 22:00. The run-parts script sequentially executes every program within the directory specified as its argument.

Scripts in /etc/cron.weekly run once per week with a delay offset of between 31 and 70 minutes.

Scripts in /etc/cron.monthly run once per week with a delay offset of between 51 and 90 minutes.

For more information, see the anacron(8) and anacrontab(5) manual pages.