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