| 1 |
.TH ANACRON 8 2012-11-22 "cronie" "System Administration" |
| 2 |
.SH NAME |
| 3 |
anacron \- runs commands periodically |
| 4 |
.SH SYNOPSIS |
| 5 |
.B anacron \fR[\fB-s\fR] [\fB-f\fR] [\fB-n\fR] [\fB-d\fR] [\fB-q\fR] |
| 6 |
[\fB-t anacrontab\fR] [\fB-S spooldir\fR] [\fIjob\fR] |
| 7 |
.br |
| 8 |
.B anacron \fR[\fB-S spooldir\fR] -u [\fB-t anacrontab\fR] \fR[\fIjob\fR] |
| 9 |
.br |
| 10 |
.B anacron \fR[\fB-V\fR|\fB-h\fR] |
| 11 |
.br |
| 12 |
.B anacron -T \fR[\fB-t anacrontab\fR] |
| 13 |
.SH DESCRIPTION |
| 14 |
.B Anacron |
| 15 |
is used to execute commands periodically, with a frequency specified in |
| 16 |
days. Unlike |
| 17 |
.BR cron(8) , |
| 18 |
it does not assume that the machine is running continuously. Hence, it |
| 19 |
can be used on machines that are not running 24 hours a day to control |
| 20 |
regular jobs as daily, weekly, and monthly jobs. |
| 21 |
.PP |
| 22 |
Anacron reads a list of jobs from the |
| 23 |
.I /etc/anacrontab |
| 24 |
configuration file (see |
| 25 |
.BR anacrontab (5)). |
| 26 |
This file contains the list of jobs that Anacron controls. Each job |
| 27 |
entry specifies a period in days, a delay in minutes, a unique job |
| 28 |
identifier, and a shell command. |
| 29 |
.PP |
| 30 |
For each job, Anacron checks whether this job has been executed in the |
| 31 |
last |
| 32 |
.B n |
| 33 |
days, where |
| 34 |
.B n |
| 35 |
is the time period specified for that job. If a job has not been |
| 36 |
executed in |
| 37 |
.B n |
| 38 |
days or more, Anacron runs the job's shell command, after waiting for the |
| 39 |
number of minutes specified as the delay parameter. |
| 40 |
.PP |
| 41 |
After the command exits, Anacron records the date (excludes the hour) in |
| 42 |
a special timestamp file for that job, so it knows when to execute that |
| 43 |
job again. |
| 44 |
.PP |
| 45 |
When there are no more jobs to be run, Anacron exits. |
| 46 |
.PP |
| 47 |
Anacron only considers jobs whose identifier, as specified in |
| 48 |
.BR anacrontab (5), |
| 49 |
matches any of the |
| 50 |
.I job |
| 51 |
command-line arguments. The |
| 52 |
.I job |
| 53 |
command-line arguments can be represented by shell wildcard patterns (be |
| 54 |
sure to protect them from your shell with adequate quoting). Specifying |
| 55 |
no |
| 56 |
.I job |
| 57 |
command-line arguments is equivalent to specifying "*" (that is, all |
| 58 |
jobs are considered by Anacron). |
| 59 |
.PP |
| 60 |
Unless Anacron is run with the |
| 61 |
.B \-d |
| 62 |
option (specified below), it forks to the background when it starts, and |
| 63 |
any parent processes exit immediately. |
| 64 |
.PP |
| 65 |
Unless Anacron is run with the |
| 66 |
.B \-s |
| 67 |
or |
| 68 |
.B \-n |
| 69 |
options, it starts jobs immediately when their delay is over. The |
| 70 |
execution of different jobs is completely independent. |
| 71 |
.PP |
| 72 |
If an executed job generates any output to standard output or to standard |
| 73 |
error, the output is mailed to the user under whom Anacron is running |
| 74 |
(usually root), or to the address specified in the |
| 75 |
.B MAILTO |
| 76 |
environment variable in the |
| 77 |
.I /etc/anacrontab |
| 78 |
file, if such exists. If the |
| 79 |
.B LOGNAME |
| 80 |
environment variable is set, it is used in the From: field of the mail. |
| 81 |
.PP |
| 82 |
Any informative messages generated by Anacron are sent to |
| 83 |
.BR syslogd (8) |
| 84 |
or |
| 85 |
.BR rsyslogd (8) |
| 86 |
under with facility set to |
| 87 |
.B cron |
| 88 |
and priority set to |
| 89 |
.BR notice . |
| 90 |
Any error messages are sent with the priority |
| 91 |
.BR error . |
| 92 |
.PP |
| 93 |
"Active" jobs (i.e., jobs that Anacron already decided to run and are now |
| 94 |
waiting for their delay to pass, and jobs that are currently being |
| 95 |
executed by Anacron), are "locked", so that other copies of Anacron |
| 96 |
cannot run them at the same time. |
| 97 |
.SH OPTIONS |
| 98 |
.TP |
| 99 |
.B \-f |
| 100 |
Forces execution of all jobs, ignoring any timestamps. |
| 101 |
.TP |
| 102 |
.B \-u |
| 103 |
Updates the timestamps of all jobs to the current date, but does not run |
| 104 |
any. |
| 105 |
.TP |
| 106 |
.B \-s |
| 107 |
Serializes execution of jobs. Anacron does not start a new job before the |
| 108 |
previous one finished. |
| 109 |
.TP |
| 110 |
.B \-n |
| 111 |
Runs jobs immediately and ignores the specified delays in the |
| 112 |
.I /etc/anacrontab |
| 113 |
file. This options implies |
| 114 |
.BR -s . |
| 115 |
.TP |
| 116 |
.B \-d |
| 117 |
Does not fork Anacron to the background. In this mode, Anacron will |
| 118 |
output informational messages to standard error, as well as to syslog. |
| 119 |
The output of any job is mailed by Anacron. |
| 120 |
.TP |
| 121 |
.B \-q |
| 122 |
Suppresses any messages to standard error. Only applicable with |
| 123 |
.BR -d . |
| 124 |
.TP |
| 125 |
.B -t some_anacrontab |
| 126 |
Uses the specified anacrontab, rather than the |
| 127 |
.I /etc/anacrontab |
| 128 |
default one. |
| 129 |
.TP |
| 130 |
.B -T |
| 131 |
Anacrontab testing. Tests the |
| 132 |
.I /etc/anacrontab |
| 133 |
configuration file for validity. If there is an error in the file, it is |
| 134 |
shown on the standard output and Anacron returns the value of 1. Valid |
| 135 |
anacrontabs return the value of 0. |
| 136 |
.TP |
| 137 |
.B -S spooldir |
| 138 |
Uses the specified spooldir to store timestamps in. This option is |
| 139 |
required for users who wish to run anacron themselves. |
| 140 |
.TP |
| 141 |
.B -V |
| 142 |
Prints version information, and exits. |
| 143 |
.TP |
| 144 |
.B -h |
| 145 |
Prints short usage message, and exits. |
| 146 |
.SH SIGNALS |
| 147 |
After receiving a |
| 148 |
.B SIGUSR1 |
| 149 |
signal, Anacron waits for any running jobs to finish and then exits. |
| 150 |
This can be used to stop Anacron cleanly. |
| 151 |
.SH NOTES |
| 152 |
Make sure your time-zone is set correctly before Anacron is started since |
| 153 |
the time-zone affects the date. This is usually accomplished by setting |
| 154 |
the TZ environment variable, or by installing a |
| 155 |
.I /usr/lib/zoneinfo/localtime |
| 156 |
file. See |
| 157 |
.BR tzset (3) |
| 158 |
for more information. |
| 159 |
.PP |
| 160 |
Timestamp files are created in the spool directory for each job specified |
| 161 |
in an anacrontab. These files are never removed automatically by |
| 162 |
Anacron, and should be removed by hand if a job is no longer being |
| 163 |
scheduled. |
| 164 |
.SH FILES |
| 165 |
.TP |
| 166 |
.I /etc/anacrontab |
| 167 |
Contains specifications of jobs. See |
| 168 |
.BR anacrontab (5) |
| 169 |
for a complete description. |
| 170 |
.TP |
| 171 |
.I /var/spool/anacron |
| 172 |
This directory is used by Anacron for storing timestamp files. |
| 173 |
.SH "SEE ALSO" |
| 174 |
.BR anacrontab (5), |
| 175 |
.BR cron (8), |
| 176 |
.BR tzset (3) |
| 177 |
.PP |
| 178 |
The Anacron |
| 179 |
.I README |
| 180 |
file. |
| 181 |
.SH BUGS |
| 182 |
Anacron never removes timestamp files. Remove unused files manually. |
| 183 |
.PP |
| 184 |
Anacron uses up to two file descriptors for each active job. It may run |
| 185 |
out of descriptors if there are lots of active jobs. See |
| 186 |
.B echo $(($(ulimit -n) / 2)) |
| 187 |
for information how many concurrent jobs anacron may run. |
| 188 |
.PP |
| 189 |
Mail comments, suggestions and bug reports to |
| 190 |
.MT shaleh@\:(debian.\:org|\:valinux.\:com) |
| 191 |
Sean 'Shaleh' Perry |
| 192 |
.ME . |
| 193 |
.SH AUTHOR |
| 194 |
Anacron was originally conceived and implemented by |
| 195 |
.MT schwarz@\:monet.\:m.\:isar.\:de |
| 196 |
Christian Schwarz |
| 197 |
.ME . |
| 198 |
.PP |
| 199 |
The current implementation is a complete rewrite by |
| 200 |
.MT itzur@\:actcom.\:co.\:il |
| 201 |
Itai Tzur |
| 202 |
.ME . |
| 203 |
.PP |
| 204 |
The code base was maintained by |
| 205 |
.MT shaleh@\:(debian.\:org|\:valinux.\:com) |
| 206 |
Sean 'Shaleh' Perry |
| 207 |
.ME . |
| 208 |
.PP |
| 209 |
Since 2004, it is maintained by |
| 210 |
.MT pasc@\:(debian.\:org|\:redellipse.\:net) |
| 211 |
Pascal Hakim |
| 212 |
.ME . |
| 213 |
.PP |
| 214 |
For Fedora, Anacron is maintained by |
| 215 |
.MT mmaslano@redhat.\:com |
| 216 |
Marcela Mašláňová |
| 217 |
.ME . |