| 1 |
.TH ANACRONTAB 5 2012-11-22 "cronie" "File Formats" |
| 2 |
.SH NAME |
| 3 |
/etc/anacrontab \- configuration file for Anacron |
| 4 |
.SH DESCRIPTION |
| 5 |
The |
| 6 |
.I /etc/anacrontab |
| 7 |
configuration file describes the jobs controlled by |
| 8 |
.BR anacron (8). |
| 9 |
It can contain three types of lines: job-description lines, environment |
| 10 |
assignments, or empty lines. |
| 11 |
.PP |
| 12 |
Job-description lines can have the following format: |
| 13 |
.PP |
| 14 |
period in days delay in minutes job-identifier command |
| 15 |
.PP |
| 16 |
The |
| 17 |
.I period in days |
| 18 |
variable specifies the frequency of execution of a job in days. This |
| 19 |
variable can be represented by an integer or a macro (@daily, @weekly, |
| 20 |
@monthly), where @daily denotes the same value as the integer 1, @weekly |
| 21 |
the same as 7, and @monthly specifies that the job is run once a month, |
| 22 |
independent on the length of the month. |
| 23 |
.PP |
| 24 |
The |
| 25 |
.I delay in minutes |
| 26 |
variable specifies the number of minutes anacron waits, if necessary, |
| 27 |
before executing a job. This variable is represented by an integer where |
| 28 |
0 means no delay. |
| 29 |
.PP |
| 30 |
The |
| 31 |
.I job-identifier |
| 32 |
variable specifies a unique name of a job which is used in the log files. |
| 33 |
.PP |
| 34 |
The |
| 35 |
.I command |
| 36 |
variable specifies the command to execute. The command can either be a |
| 37 |
command such as |
| 38 |
.B ls /proc >> /tmp/proc |
| 39 |
or a command to execute a custom script. |
| 40 |
.PP |
| 41 |
Environment assignment lines can have the following format: |
| 42 |
.PP |
| 43 |
VAR=VALUE |
| 44 |
.PP |
| 45 |
Any spaces around |
| 46 |
.I VAR |
| 47 |
are removed. No spaces around |
| 48 |
.I VALUE |
| 49 |
are allowed (unless you want them to be part of the value). The |
| 50 |
specified assignment takes effect from the next line until the end of the |
| 51 |
file, or to the next assignment of the same variable. |
| 52 |
.PP |
| 53 |
The |
| 54 |
.I START_HOURS_RANGE |
| 55 |
variable defines an interval (in hours) when scheduled jobs can be run. |
| 56 |
In case this time interval is missed, for example, due to a power down, |
| 57 |
then scheduled jobs are not executed that day. |
| 58 |
.PP |
| 59 |
The |
| 60 |
.I RANDOM_DELAY |
| 61 |
variable denotes the maximum number of minutes that will be added to the |
| 62 |
delay in minutes variable which is specified for each job. A |
| 63 |
.I RANDOM_DELAY |
| 64 |
set to 12 would therefore add, randomly, between 0 and 12 minutes to the |
| 65 |
delay in minutes for each job in that particular anacrontab. When set to |
| 66 |
0, no random delay is added. |
| 67 |
.PP |
| 68 |
If |
| 69 |
.I MAILTO |
| 70 |
is defined (and non-empty), mail is sent to the specified address, |
| 71 |
otherwise, system user is used. |
| 72 |
.PP |
| 73 |
If |
| 74 |
.I MAILFROM |
| 75 |
is defined (and non-empty), it is used as the envelope sender address, |
| 76 |
otherwise, system user is used. |
| 77 |
.PP |
| 78 |
(Note: Both |
| 79 |
.I MAILFROM |
| 80 |
and |
| 81 |
.I MAILTO |
| 82 |
variables are expanded, so setting them as in the following example works as expected: [email protected] ($USER is replaced by the system user) ) |
| 83 |
.PP |
| 84 |
If |
| 85 |
.I NO_MAIL_OUTPUT |
| 86 |
is defined (and non-empty), the standard output and error descriptors of job processes are not redirected and e-mailed. |
| 87 |
.PP |
| 88 |
.PP |
| 89 |
Empty lines are either blank lines, line containing white spaces only, or |
| 90 |
lines with white spaces followed by a '#' followed by an arbitrary |
| 91 |
comment. |
| 92 |
.PP |
| 93 |
You can continue a line onto the next line by adding a '\\' at the end of it. |
| 94 |
.PP |
| 95 |
In case you want to disable Anacron, add a line with |
| 96 |
.I 0anacron |
| 97 |
which is the name of the script running the Anacron into the |
| 98 |
.I /etc/cron.hourly/jobs.deny |
| 99 |
file. |
| 100 |
.SH EXAMPLE |
| 101 |
This example shows how to set up an Anacron job similar in functionality to |
| 102 |
.I /etc/crontab |
| 103 |
which starts all regular jobs |
| 104 |
between 6:00 and 8:00 |
| 105 |
.I only. |
| 106 |
A |
| 107 |
.I RANDOM_DELAY |
| 108 |
which can be 30 minutes at the most is specified. Jobs will run |
| 109 |
serialized in a queue where each job is started only after the previous |
| 110 |
one is finished. |
| 111 |
.PP |
| 112 |
.nf |
| 113 |
# environment variables |
| 114 |
SHELL=/bin/sh |
| 115 |
PATH=/sbin:/bin:/usr/sbin:/usr/bin |
| 116 |
MAILTO=root |
| 117 |
RANDOM_DELAY=30 |
| 118 |
# Anacron jobs will start between 6am and 8am. |
| 119 |
START_HOURS_RANGE=6-8 |
| 120 |
# delay will be 5 minutes + RANDOM_DELAY for cron.daily |
| 121 |
1 5 cron.daily nice run-parts /etc/cron.daily |
| 122 |
7 0 cron.weekly nice run-parts /etc/cron.weekly |
| 123 |
@monthly 0 cron.monthly nice run-parts /etc/cron.monthly |
| 124 |
.fi |
| 125 |
.SH "SEE ALSO" |
| 126 |
.BR anacron (8), |
| 127 |
.BR crontab (1) |
| 128 |
.PP |
| 129 |
The Anacron |
| 130 |
.I README |
| 131 |
file. |
| 132 |
.SH AUTHOR |
| 133 |
.MT itzur@\:actcom.\:co.\:il |
| 134 |
Itai Tzur |
| 135 |
.ME |
| 136 |
.PP |
| 137 |
Currently maintained by |
| 138 |
.MT pasc@\:(debian.\:org|\:redellipse.\:net) |
| 139 |
Pascal Hakim |
| 140 |
.ME . |
| 141 |
.PP |
| 142 |
For Fedora, maintained by |
| 143 |
.MT [email protected] |
| 144 |
Marcela Mašláňová |
| 145 |
.ME . |