man-pages/man8/anacron.8.html
2021-03-31 01:06:50 +01:00

304 lines
9.2 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of ANACRON</TITLE>
</HEAD><BODY>
<H1>ANACRON</H1>
Section: Anacron Users' Manual (8)<BR>Updated: 2018-11-30<BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
anacron - runs commands periodically
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>
<B>anacron </B>[<B>-s</B>] [<B>-f</B>] [<B>-n</B>] [<B>-d</B>] [<B>-q</B>]
[<B>-t anacrontab</B>] [<B>-S spooldir</B>] [<I>job</I>] ...
<BR>
<B>anacron [-S spooldir</B>] -u [<B>-t anacrontab</B>] [<I>job</I>] ...
<BR>
<B>anacron </B>[<B>-V</B>|<B>-h</B>]
<BR>
<B>anacron -T [-t anacrontab</B>]
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
Anacron
can be used to execute commands periodically, with a
frequency specified in days. Unlike <B><A HREF="/cgi-bin/man/man2html?8+cron">cron</A>(8)</B>,
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 <B>cron</B>.
<P>
When executed, Anacron reads a list of jobs from a configuration file, normally
<I>/etc/anacrontab</I>
(see <B><A HREF="/cgi-bin/man/man2html?5+anacrontab">anacrontab</A>(5)</B>). 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.
<P>
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.
<P>
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.
<P>
When there are no more jobs to be run, Anacron exits.
<P>
Anacron only considers jobs whose identifier, as
specified in the <I>anacrontab</I> matches any of
the
<I>job</I>
command-line arguments. The
<I>job</I>
arguments can be shell wildcard patterns (be sure to protect them from
your shell with adequate quoting). Specifying no
<I>job</I>
arguments, is equivalent to specifying &quot;*&quot; (That is, all jobs will be
considered).
<P>
Unless the <B>-d</B> option is given (see below), Anacron forks to the
background when it starts, and the parent process exits
immediately.
<P>
Unless the <B>-s</B> or <B>-n</B> options are given, Anacron starts jobs
immediately when their delay is over. The execution of different jobs is
completely independent.
<P>
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 crontab, if such
exists.
<P>
Informative messages about what Anacron is doing are sent to <B><A HREF="/cgi-bin/man/man2html?8+syslogd">syslogd</A>(8)</B>
under facility <B>cron</B>, priority <B>notice</B>. Error messages are sent at
priority <B>error</B>.
<P>
&quot;Active&quot; 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 &quot;locked&quot;, so that other copies of Anacron won't run them
at the same time.
<A NAME="lbAE">&nbsp;</A>
<H2>OPTIONS</H2>
<DL COMPACT>
<DT id="1"><B>-f</B>
<DD>
Force execution of the jobs, ignoring the timestamps.
<DT id="2"><B>-u</B>
<DD>
Only update the timestamps of the jobs, to the current date, but
don't run anything.
<DT id="3"><B>-s</B>
<DD>
Serialize execution of jobs. Anacron will not start a new job before the
previous one finished.
<DT id="4"><B>-n</B>
<DD>
Run jobs now. Ignore the delay specifications in the
<I>/etc/anacrontab</I>
file. This options implies <B>-s</B>.
<DT id="5"><B>-d</B>
<DD>
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.
<DT id="6"><B>-q</B>
<DD>
Suppress messages to standard error. Only applicable with <B>-d</B>.
<DT id="7"><B>-t anacrontab</B>
<DD>
Use specified anacrontab, rather than the default
<DT id="8"><B>-T</B>
<DD>
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.
<DT id="9"><B>-S spooldir</B>
<DD>
Use the specified spooldir to store timestamps in. This option is required for
users who wish to run anacron themselves.
<DT id="10"><B>-V</B>
<DD>
Print version information, and exit.
<DT id="11"><B>-h</B>
<DD>
Print short usage message, and exit.
</DL>
<A NAME="lbAF">&nbsp;</A>
<H2>SIGNALS</H2>
After receiving a <B>SIGUSR1</B> signal, Anacron waits for running
jobs, if any, to finish and then exits. This can be used to stop
Anacron cleanly.
<A NAME="lbAG">&nbsp;</A>
<H2>NOTES</H2>
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 TZ environment variable, or by installing a
<I>/usr/lib/zoneinfo/localtime</I>
file. See
<B><A HREF="/cgi-bin/man/man2html?3+tzset">tzset</A>(3)</B>
for more information.
<P>
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.
<A NAME="lbAH">&nbsp;</A>
<H2>DEBIAN-SPECIFIC CONFIGURATION</H2>
<P>
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.
<P>
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. Please read Debian-specific documentation in
<I>/usr/share/doc/anacron/README.Debian</I>
file for detailed instruction in now to change such behaviour.
<A NAME="lbAI">&nbsp;</A>
<H2>FILES</H2>
<DL COMPACT>
<DT id="12"><I>/etc/anacrontab</I>
<DD>
Contains specifications of jobs. See <B><A HREF="/cgi-bin/man/man2html?5+anacrontab">anacrontab</A>(5)</B> for a complete
description.
<DT id="13"><I>/var/spool/anacron</I>
<DD>
This directory is used by Anacron for storing timestamp files.
<DT id="14"><I>/lib/systemd/system/anacron.service</I>
<DD>
This file provides systemd service for anacron.
<DT id="15"><I>/lib/systemd/system/anacron.timer</I>
<DD>
This file provides systemd timer for anacron. Currently the service is
triggered hourly through systemd timer.
</DL>
<A NAME="lbAJ">&nbsp;</A>
<H2>SEE ALSO</H2>
<B><A HREF="/cgi-bin/man/man2html?5+anacrontab">anacrontab</A>(5), <A HREF="/cgi-bin/man/man2html?8+cron">cron</A>(8), <A HREF="/cgi-bin/man/man2html?3+tzset">tzset</A>(3)</B>
<P>
The Anacron
<I>README</I>
file.
<P>
For Debian-specific modifications, please read
<I>/usr/share/doc/anacron/README.Debian</I>
file for detailed information.
<A NAME="lbAK">&nbsp;</A>
<H2>BUGS</H2>
Anacron never removes timestamp files. Remove unused files manually.
<P>
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).
<P>
Mail comments, suggestions and bug reports to Sean 'Shaleh' Perry &lt;shaleh@(debian.org|valinux.com)&gt;.
<A NAME="lbAL">&nbsp;</A>
<H2>AUTHOR</H2>
Anacron was originally conceived and implemented by Christian Schwarz
&lt;<A HREF="mailto:schwarz@monet.m.isar.de">schwarz@monet.m.isar.de</A>&gt;. The current implementation is a complete rewrite by
Itai Tzur &lt;<A HREF="mailto:itzur@actcom.co.il">itzur@actcom.co.il</A>&gt;.
<P>
The code base was maintained by Sean 'Shaleh' Perry &lt;shaleh@(debian.org|valinux.com)&gt;.
During 2004-2006, it was maintained by Pascal Hakim &lt;pasc@(debian.org|redellipse.net)&gt;.
During 2009-2014, it was maintained by Peter Eisentraut &lt;<A HREF="mailto:petere@debian.org">petere@debian.org</A>&gt;.
<P>
Nowadays anacron in Debian is co-maintained by various developers
from Debian Project.
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="16"><A HREF="#lbAB">NAME</A><DD>
<DT id="17"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT id="18"><A HREF="#lbAD">DESCRIPTION</A><DD>
<DT id="19"><A HREF="#lbAE">OPTIONS</A><DD>
<DT id="20"><A HREF="#lbAF">SIGNALS</A><DD>
<DT id="21"><A HREF="#lbAG">NOTES</A><DD>
<DT id="22"><A HREF="#lbAH">DEBIAN-SPECIFIC CONFIGURATION</A><DD>
<DT id="23"><A HREF="#lbAI">FILES</A><DD>
<DT id="24"><A HREF="#lbAJ">SEE ALSO</A><DD>
<DT id="25"><A HREF="#lbAK">BUGS</A><DD>
<DT id="26"><A HREF="#lbAL">AUTHOR</A><DD>
</DL>
<HR>
This document was created by
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 00:06:10 GMT, March 31, 2021
</BODY>
</HTML>