Debian Codegraph @

upstream/debian-trixie/man8/anacron.8

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