2019-08-06 18:08:05 +02:00
|
|
|
.TH ANACRON 8 2012-11-22 "cronie" "System Administration"
|
2017-05-08 15:30:03 +02:00
|
|
|
.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 \fR[\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 \fR[\fB-t anacrontab\fR]
|
|
|
|
.SH DESCRIPTION
|
2019-08-06 18:08:05 +02:00
|
|
|
.B Anacron
|
|
|
|
is used to execute commands periodically, with a frequency specified in
|
|
|
|
days. Unlike
|
|
|
|
.BR cron(8) ,
|
|
|
|
it does not assume that the machine is running continuously. Hence, it
|
|
|
|
can be used on machines that are not running 24 hours a day to control
|
|
|
|
regular jobs as daily, weekly, and monthly jobs.
|
2017-05-08 15:30:03 +02:00
|
|
|
.PP
|
|
|
|
Anacron reads a list of jobs from the
|
|
|
|
.I /etc/anacrontab
|
2019-08-06 18:08:05 +02:00
|
|
|
configuration file (see
|
|
|
|
.BR anacrontab (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
|
|
|
|
.B n
|
|
|
|
days, where
|
|
|
|
.B n
|
|
|
|
is the time period specified for that job. If a job has not been
|
|
|
|
executed in
|
|
|
|
.B n
|
|
|
|
days or more, 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 (excludes the hour) in
|
|
|
|
a special timestamp file for that job, so it knows when to execute that
|
|
|
|
job again.
|
2017-05-08 15:30:03 +02:00
|
|
|
.PP
|
|
|
|
When there are no more jobs to be run, Anacron exits.
|
|
|
|
.PP
|
2019-08-06 18:08:05 +02:00
|
|
|
Anacron only considers jobs whose identifier, as specified in
|
|
|
|
.BR anacrontab (5),
|
|
|
|
matches any of the
|
2017-05-08 15:30:03 +02:00
|
|
|
.I job
|
|
|
|
command-line arguments. The
|
|
|
|
.I job
|
2019-08-06 18:08:05 +02:00
|
|
|
command-line arguments can be represented by shell wildcard patterns (be
|
|
|
|
sure to protect them from your shell with adequate quoting). Specifying
|
|
|
|
no
|
2017-05-08 15:30:03 +02:00
|
|
|
.I job
|
2019-08-06 18:08:05 +02:00
|
|
|
command-line arguments is equivalent to specifying "*" (that is, all
|
|
|
|
jobs are considered by Anacron).
|
|
|
|
.PP
|
|
|
|
Unless Anacron is run with the
|
|
|
|
.B \-d
|
|
|
|
option (specified below), it forks to the background when it starts, and
|
|
|
|
any parent processes exit immediately.
|
|
|
|
.PP
|
|
|
|
Unless Anacron is run with the
|
|
|
|
.B \-s
|
|
|
|
or
|
|
|
|
.B \-n
|
|
|
|
options, it starts jobs immediately when their delay is over. The
|
|
|
|
execution of different jobs is completely independent.
|
|
|
|
.PP
|
|
|
|
If an executed job generates any output to standard output or to standard
|
|
|
|
error, the output is mailed to the user under whom Anacron is running
|
|
|
|
(usually root), or to the address specified in the
|
|
|
|
.B MAILTO
|
|
|
|
environment variable in the
|
|
|
|
.I /etc/anacrontab
|
|
|
|
file, if such exists. If the
|
|
|
|
.B LOGNAME
|
|
|
|
environment variable is set, it is used in the From: field of the mail.
|
|
|
|
.PP
|
|
|
|
Any informative messages generated by Anacron are sent to
|
|
|
|
.BR syslogd (8)
|
|
|
|
or
|
|
|
|
.BR rsyslogd (8)
|
|
|
|
under with facility set to
|
|
|
|
.B cron
|
|
|
|
and priority set to
|
|
|
|
.BR notice .
|
|
|
|
Any error messages are sent with the priority
|
|
|
|
.BR error .
|
|
|
|
.PP
|
|
|
|
"Active" jobs (i.e., jobs that Anacron already decided to run and are now
|
|
|
|
waiting for their delay to pass, and jobs that are currently being
|
|
|
|
executed by Anacron), are "locked", so that other copies of Anacron
|
|
|
|
cannot run them at the same time.
|
2017-05-08 15:30:03 +02:00
|
|
|
.SH OPTIONS
|
|
|
|
.TP
|
2019-08-06 18:08:05 +02:00
|
|
|
.B \-f
|
2017-05-08 15:30:03 +02:00
|
|
|
Forces execution of all jobs, ignoring any timestamps.
|
|
|
|
.TP
|
2019-08-06 18:08:05 +02:00
|
|
|
.B \-u
|
|
|
|
Updates the timestamps of all jobs to the current date, but does not run
|
|
|
|
any.
|
2017-05-08 15:30:03 +02:00
|
|
|
.TP
|
2019-08-06 18:08:05 +02:00
|
|
|
.B \-s
|
2017-05-08 15:30:03 +02:00
|
|
|
Serializes execution of jobs. Anacron does not start a new job before the
|
|
|
|
previous one finished.
|
|
|
|
.TP
|
2019-08-06 18:08:05 +02:00
|
|
|
.B \-n
|
2017-05-08 15:30:03 +02:00
|
|
|
Runs jobs immediately and ignores the specified delays in the
|
|
|
|
.I /etc/anacrontab
|
2019-08-06 18:08:05 +02:00
|
|
|
file. This options implies
|
|
|
|
.BR -s .
|
2017-05-08 15:30:03 +02:00
|
|
|
.TP
|
2019-08-06 18:08:05 +02:00
|
|
|
.B \-d
|
|
|
|
Does not fork Anacron to the background. In this mode, Anacron will
|
|
|
|
output informational messages to standard error, as well as to syslog.
|
|
|
|
The output of any job is mailed by Anacron.
|
2017-05-08 15:30:03 +02:00
|
|
|
.TP
|
2019-08-06 18:08:05 +02:00
|
|
|
.B \-q
|
|
|
|
Suppresses any messages to standard error. Only applicable with
|
|
|
|
.BR -d .
|
2017-05-08 15:30:03 +02:00
|
|
|
.TP
|
|
|
|
.B -t some_anacrontab
|
|
|
|
Uses the specified anacrontab, rather than the
|
|
|
|
.I /etc/anacrontab
|
|
|
|
default one.
|
|
|
|
.TP
|
|
|
|
.B -T
|
2019-08-06 18:08:05 +02:00
|
|
|
Anacrontab testing. Tests the
|
2017-05-08 15:30:03 +02:00
|
|
|
.I /etc/anacrontab
|
2019-08-06 18:08:05 +02:00
|
|
|
configuration file for validity. If there is an error in the file, it is
|
|
|
|
shown on the standard output and Anacron returns the value of 1. Valid
|
|
|
|
anacrontabs return the value of 0.
|
2017-05-08 15:30:03 +02:00
|
|
|
.TP
|
|
|
|
.B -S spooldir
|
2019-08-06 18:08:05 +02:00
|
|
|
Uses the specified spooldir to store timestamps in. This option is
|
|
|
|
required for users who wish to run anacron themselves.
|
2017-05-08 15:30:03 +02:00
|
|
|
.TP
|
|
|
|
.B -V
|
|
|
|
Prints version information, and exits.
|
|
|
|
.TP
|
|
|
|
.B -h
|
|
|
|
Prints short usage message, and exits.
|
|
|
|
.SH SIGNALS
|
2019-08-06 18:08:05 +02:00
|
|
|
After receiving a
|
|
|
|
.B SIGUSR1
|
|
|
|
signal, Anacron waits for any running jobs to finish and then exits.
|
|
|
|
This can be used to stop Anacron cleanly.
|
2017-05-08 15:30:03 +02:00
|
|
|
.SH NOTES
|
2019-08-06 18:08:05 +02:00
|
|
|
Make sure your time-zone is set correctly before Anacron is started since
|
|
|
|
the time-zone affects the date. This is usually accomplished by setting
|
|
|
|
the TZ environment variable, or by installing a
|
2017-05-08 15:30:03 +02:00
|
|
|
.I /usr/lib/zoneinfo/localtime
|
|
|
|
file. See
|
2019-08-06 18:08:05 +02:00
|
|
|
.BR tzset (3)
|
2017-05-08 15:30:03 +02:00
|
|
|
for more information.
|
2019-08-06 18:08:05 +02:00
|
|
|
.PP
|
|
|
|
Timestamp files are created in the spool directory for each job specified
|
|
|
|
in an anacrontab. These files are never removed automatically by
|
|
|
|
Anacron, and should be removed by hand if a job is no longer being
|
|
|
|
scheduled.
|
2017-05-08 15:30:03 +02:00
|
|
|
.SH FILES
|
|
|
|
.TP
|
|
|
|
.I /etc/anacrontab
|
2019-08-06 18:08:05 +02:00
|
|
|
Contains specifications of jobs. See
|
|
|
|
.BR anacrontab (5)
|
|
|
|
for a complete description.
|
2017-05-08 15:30:03 +02:00
|
|
|
.TP
|
|
|
|
.I /var/spool/anacron
|
|
|
|
This directory is used by Anacron for storing timestamp files.
|
|
|
|
.SH "SEE ALSO"
|
2019-08-06 18:08:05 +02:00
|
|
|
.BR anacrontab (5),
|
|
|
|
.BR cron (8),
|
|
|
|
.BR tzset (3)
|
2017-05-08 15:30:03 +02:00
|
|
|
.PP
|
|
|
|
The Anacron
|
|
|
|
.I README
|
|
|
|
file.
|
|
|
|
.SH BUGS
|
|
|
|
Anacron never removes timestamp files. Remove unused files manually.
|
|
|
|
.PP
|
2019-08-06 18:08:05 +02:00
|
|
|
Anacron uses up to two file descriptors for each active job. It may run
|
|
|
|
out of descriptors if there are lots of active jobs. See
|
|
|
|
.B echo $(($(ulimit -n) / 2))
|
|
|
|
for information how many concurent jobs anacron may run.
|
2017-05-08 15:30:03 +02:00
|
|
|
.PP
|
2019-08-06 18:08:05 +02:00
|
|
|
Mail comments, suggestions and bug reports to
|
|
|
|
.MT shaleh@\:(debian.\:org|\:valinux.\:com)
|
|
|
|
Sean 'Shaleh' Perry
|
|
|
|
.ME .
|
2017-05-08 15:30:03 +02:00
|
|
|
.SH AUTHOR
|
2019-08-06 18:08:05 +02:00
|
|
|
Anacron was originally conceived and implemented by
|
|
|
|
.MT schwarz@\:monet.\:m.\:isar.\:de
|
|
|
|
Christian Schwarz
|
|
|
|
.ME .
|
|
|
|
.PP
|
|
|
|
The current implementation is a complete rewrite by
|
|
|
|
.MT itzur@\:actcom.\:co.\:il
|
|
|
|
Itai Tzur
|
|
|
|
.ME .
|
|
|
|
.PP
|
|
|
|
The code base was maintained by
|
|
|
|
.MT shaleh@\:(debian.\:org|\:valinux.\:com)
|
|
|
|
Sean 'Shaleh' Perry
|
|
|
|
.ME .
|
|
|
|
.PP
|
|
|
|
Since 2004, it is maintained by
|
|
|
|
.MT pasc@\:(debian.\:org|\:redellipse.\:net)
|
|
|
|
Pascal Hakim
|
|
|
|
.ME .
|
|
|
|
.PP
|
|
|
|
For Fedora, Anacron is maintained by
|
|
|
|
.MT mmaslano@redhat.\:com
|
|
|
|
Marcela Mašláňová
|
|
|
|
.ME .
|