| 1 |
.TH ANACRON 8 2025-12-17 "The Debian Project" "Anacron Users' Manual" |
| 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\-v\fR] [\fB\-Q\fR] [\fB\-t anacrontab\fR] [\fB\-S spooldir\fR] [\fIjob\fR] ... |
| 7 |
.br |
| 8 |
.B anacron [\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 [\fB\-t anacrontab\fR] |
| 13 |
.br |
| 14 |
.B anacron \-H file |
| 15 |
.br |
| 16 |
.B anacron \-\-list\-obsolete\-timestamp\-files [\fB\-t anacrontab\fR] [\fB\-S spooldir\fR] |
| 17 |
.SH DESCRIPTION |
| 18 |
Anacron can be used to execute commands periodically, with a frequency |
| 19 |
specified in days.\& |
| 20 |
Unlike \fBcron\fR(8), it does not assume that the machine is running |
| 21 |
continuously.\& |
| 22 |
Hence, it can be used on machines that aren't running 24 hours a day, |
| 23 |
to control daily, weekly, and monthly jobs that are usually controlled by |
| 24 |
\fBcron\fR.\& |
| 25 |
.PP |
| 26 |
When executed, Anacron reads a list of jobs from a configuration file, normally |
| 27 |
.I /etc/anacrontab |
| 28 |
(see \fBanacrontab\fR(5)).\& |
| 29 |
This file contains the list of jobs that Anacron controls.\& |
| 30 |
Each job entry specifies a period in days, a delay in minutes, a unique job |
| 31 |
identifier, and a shell command.\& |
| 32 |
.PP |
| 33 |
For each job, Anacron checks whether this job has been executed in the last |
| 34 |
n days, where n is the period specified for that job.\& |
| 35 |
If not, Anacron runs the job's shell command, after waiting for the number of |
| 36 |
minutes specified as the delay parameter.\& |
| 37 |
.PP |
| 38 |
After the command exits, Anacron records the date in a special timestamp file |
| 39 |
for that job, so it can know when to execute it again.\& |
| 40 |
Only the date is used for the time calculations.\& |
| 41 |
The hour is not used.\& |
| 42 |
.PP |
| 43 |
When there are no more jobs to be run, Anacron exits.\& |
| 44 |
.PP |
| 45 |
Anacron only considers jobs whose identifier, as specified in the |
| 46 |
\fIanacrontab\fR matches any of the |
| 47 |
.I job |
| 48 |
command-line arguments.\& |
| 49 |
The |
| 50 |
.I job |
| 51 |
arguments can be shell wildcard patterns (be sure to protect them from your |
| 52 |
shell with adequate quoting).\& |
| 53 |
Specifying no |
| 54 |
.I job |
| 55 |
arguments, is equivalent to specifying "*".\& |
| 56 |
(That is, all jobs will be considered).\& |
| 57 |
.PP |
| 58 |
Unless the \fB\-d\fR option is given (see below), Anacron forks to the |
| 59 |
background when it starts, and the parent process exits immediately.\& |
| 60 |
.PP |
| 61 |
Unless the \fB\-s\fR or \fB\-n\fR options are given, Anacron starts jobs |
| 62 |
immediately when their delay is over.\& |
| 63 |
The execution of different jobs is completely independent.\& |
| 64 |
.PP |
| 65 |
If a job generates any output on its standard output or standard error, the |
| 66 |
output is mailed to the user running Anacron (usually root), or to the address |
| 67 |
contained by the MAILTO environment variable in the /etc/anacrontab file, if |
| 68 |
such exists.\& |
| 69 |
.PP |
| 70 |
Informative messages about what Anacron is doing are sent to \fBsyslogd\fR(8) |
| 71 |
under facility \fBcron\fR, priority \fBnotice\fR.\& |
| 72 |
Error messages are sent at priority \fBerror\fR.\& |
| 73 |
.PP |
| 74 |
"Active" jobs (i.e.\& jobs that Anacron already decided to run and now wait for |
| 75 |
their delay to pass, and jobs that are currently being executed by Anacron), |
| 76 |
are "locked", so that other copies of Anacron won't run them at the same |
| 77 |
time.\& |
| 78 |
.SH OPTIONS |
| 79 |
.TP |
| 80 |
.B \-f |
| 81 |
Force execution of the jobs, ignoring the timestamps.\& |
| 82 |
.TP |
| 83 |
.B \-u |
| 84 |
Only update the timestamps of the jobs, to the current date, but |
| 85 |
don't run anything.\& |
| 86 |
.TP |
| 87 |
.B \-s |
| 88 |
Serialize execution of jobs.\& |
| 89 |
Anacron will not start a new job before the previous one finished.\& |
| 90 |
.TP |
| 91 |
.B \-n |
| 92 |
Run jobs now.\& |
| 93 |
Ignore the delay specifications in the |
| 94 |
.I /etc/anacrontab |
| 95 |
file.\& |
| 96 |
This options implies \fB\-s\fR.\& |
| 97 |
.TP |
| 98 |
.B \-d |
| 99 |
Don't fork to the background.\& |
| 100 |
In this mode, Anacron will output informational messages to standard error, as |
| 101 |
well as to syslog.\& |
| 102 |
The output of jobs is mailed as usual.\& |
| 103 |
.TP |
| 104 |
.B \-q |
| 105 |
Suppress messages to standard error.\& |
| 106 |
Only applicable with \fB\-d\fR.\& |
| 107 |
.TP |
| 108 |
.B \-v |
| 109 |
Enable verbose logging for debugging.\& |
| 110 |
.TP |
| 111 |
.B \-Q |
| 112 |
Enable quiet syslog.\& |
| 113 |
.TP |
| 114 |
.B \-t anacrontab |
| 115 |
Use specified anacrontab, rather than the default.\& |
| 116 |
.TP |
| 117 |
.B \-T |
| 118 |
Anacrontab testing.\& |
| 119 |
The configuration file will be tested for validity.\& |
| 120 |
If there is an error in the file, an error will be shown and anacron will |
| 121 |
return 1.\& |
| 122 |
Valid anacrontabs will return 0.\& |
| 123 |
.TP |
| 124 |
.B \-S spooldir |
| 125 |
Use the specified spooldir to store timestamps in.\& |
| 126 |
This option is required for users who wish to run anacron themselves.\& |
| 127 |
.TP |
| 128 |
.B \-l, \-\-list\-obsolete\-timestamp\-files |
| 129 |
Print obsolete timestamp files relative to anacrontab and spooldir.\& |
| 130 |
.TP |
| 131 |
.B \-H |
| 132 |
Print Base64 encoded hash of file for job in anacrontab, and exit.\& |
| 133 |
.TP |
| 134 |
.B \-V |
| 135 |
Print version information, and exit.\& |
| 136 |
.TP |
| 137 |
.B \-h |
| 138 |
Print short usage message, and exit.\& |
| 139 |
.SH SIGNALS |
| 140 |
After receiving a \fBSIGUSR1\fR signal, Anacron waits for running jobs, if any, |
| 141 |
to finish and then exits.\& |
| 142 |
This can be used to stop Anacron cleanly.\& |
| 143 |
.SH NOTES |
| 144 |
Make sure that the time-zone is set correctly before Anacron is started.\& |
| 145 |
(The time-zone affects the date).\& |
| 146 |
This is usually accomplished by setting the \fBTZ\fR environment variable, or |
| 147 |
by installing a |
| 148 |
.I /usr/lib/zoneinfo/localtime |
| 149 |
file.\& |
| 150 |
See \fBtzset\fR(3) for more information.\& |
| 151 |
.PP |
| 152 |
Timestamp files are created in the spool directory for each job in |
| 153 |
anacrontab.\& |
| 154 |
These are never removed automatically by anacron, and should be removed by |
| 155 |
hand if a job is no longer being scheduled.\& |
| 156 |
.SH DEBIAN-SPECIFIC CONFIGURATION |
| 157 |
On Debian-based systems, anacron will be activated hourly every day from 07:30 |
| 158 |
local time to 23:30 local time through cron job (on non-systemd systems where |
| 159 |
cron is installed and enabled) or systemd timer (on systemd-based systems).\& |
| 160 |
On activation, anacron will check if it missed some jobs.\& |
| 161 |
If yes, it will start those jobs after a short period of time.\& |
| 162 |
.PP |
| 163 |
By default, the hourly activation of anacron will not take place when the |
| 164 |
system is using battery and no AC power is connected to the computer.\& |
| 165 |
It is meant to reduce power usage and extend battery life, but such design |
| 166 |
might lead to unwanted results.\& |
| 167 |
Users may disable this feature and let anacron run regardless of power |
| 168 |
supply.\& |
| 169 |
.PP |
| 170 |
Please read Debian-specific documentation in |
| 171 |
.I /usr/share/doc/anacron/README.Debian |
| 172 |
file for detailed instruction in how to change such behaviour.\& |
| 173 |
.SH FILES |
| 174 |
.TP |
| 175 |
.I /etc/anacrontab |
| 176 |
Contains specifications of jobs. |
| 177 |
See \fBanacrontab\fR(5) for a complete description.\& |
| 178 |
.TP |
| 179 |
.I /var/spool/anacron |
| 180 |
This directory is used by Anacron for storing timestamp files.\& |
| 181 |
.TP |
| 182 |
.I /lib/systemd/system/anacron.service |
| 183 |
This file provides systemd service for anacron.\& |
| 184 |
.TP |
| 185 |
.I /lib/systemd/system/anacron.timer |
| 186 |
This file provides systemd timer for anacron. |
| 187 |
Currently the service is triggered hourly through systemd timer.\& |
| 188 |
.SH "SEE ALSO" |
| 189 |
\fBanacrontab\fR(5), \fBcron\fR(8), \fBtzset\fR(3) |
| 190 |
.PP |
| 191 |
The Anacron |
| 192 |
.I README |
| 193 |
file.\& |
| 194 |
.PP |
| 195 |
For Debian-specific modifications, please read |
| 196 |
.I /usr/share/doc/anacron/README.Debian |
| 197 |
file for detailed information.\& |
| 198 |
.SH BUGS |
| 199 |
Anacron never removes timestamp files. Remove unused files manually.\& |
| 200 |
.PP |
| 201 |
Anacron uses up to two file descriptors for each active job.\& |
| 202 |
It may run out of descriptors if there are more than about 125 active jobs |
| 203 |
(on normal kernels).\& |
| 204 |
.PP |
| 205 |
Mail comments, suggestions and bug reports to Debian's BTS for Anacron by |
| 206 |
emailing \%[email protected]>.\& |
| 207 |
.SH AUTHOR |
| 208 |
Anacron was originally conceived and implemented by Christian Schwarz |
| 209 |
\%<[email protected]>.\& |
| 210 |
The current implementation is a complete rewrite by |
| 211 |
Itai Tzur \%<[email protected]>.\& |
| 212 |
.PP |
| 213 |
The code base was maintained by Sean \&'Shaleh'\& Perry |
| 214 |
\%<shaleh@(debian.org|valinux.com)>.\& |
| 215 |
During 2004\(en2006, it was maintained by Pascal Hakim |
| 216 |
\%<pasc@(debian.org|redellipse.net)>.\& |
| 217 |
During 2009\(en2014, it was maintained by Peter Eisentraut |
| 218 |
\%<[email protected]>.\& |
| 219 |
.PP |
| 220 |
Nowadays anacron in Debian is co-maintained by various developers from Debian |
| 221 |
Project.\& |