anacron

runs commands periodically

anacron [-s] [-f] [-n] [-d] [-q] [-t anacrontab] [-S spooldir] [job]
anacron [-S spooldir] -u [-t anacrontab] [job]
anacron [-V|-h]
anacron -T [-t anacrontab]

Execute commands periodically, with a frequency specified in days. does not assume that the system is running continuously.
That is, commands missed when system is not running will be run next time system is up!

Reads a list of jobs from /etc/anacrontab (see anacrontab(5)).
Each job entry specifies a period in days, a delay in minutes, a unique job identifier, and a shell command.
If this job has not executed in the last n days, it is started after waiting for delay.
After the command exits, records the date.

Only considers jobs whose identifier, matches any of the job command-line arguments which can be shell wildcard patterns (be sure to protect them from your shell with adequate quoting).
With no job arguments all jobs will be considered.

starts jobs when delay is over. The execution of jobs is independent, unless -s or -n are given,

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.

Notices are sent to syslogd) with facility cron

"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.

-f Force execution of the jobs, ignoring the timestamps.
-u update the timestamps of the jobs only, to the current date, but don't run anything.
-s serialize execution of jobs. don not start a new job until the previous one finished.
-n Run jobs now. Ignore delay, implies -s
-d Don't fork to the background. messages to standard error, as well as to syslog.
The output of jobs is mailed as usual.
-q quietly suppress messages to standard error. Only applicable with -d.
-t anacrontab rather than the default
-T Test the configuration file
-S spooldir Spooldir to store timestamps for users to run anacron themselves, i.e. not system daemon.
-V version and exit.
-h usage message, and exit.

Signals

To stop cleanly send a SIGUSR1 . Waits for running jobs, to finish and exits.

time-zone must be set correctly by setting $TZ , or by installing a /usr/lib/zoneinfo/localtime

Timestamp files created in the spool directory for each job are not removed.

FILES

/etc/anacrontab Contains specifications of jobs.

SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
HOME=/root
LOGNAME=root

# These replace cron's entries
1 5 cron.daily run-parts --report /etc/cron.daily
7 10 cron.weekly run-parts --report /etc/cron.weekly
@monthly 15 cron.monthly run-parts --report /etc/cron.monthly

/var/spool/anacron default directory for storing timestamp files .

anacrontab

Job-description lines

The period is specified in days, the delay in minutes.
The job-identifier can contain any non-blank character, except slashes to identify the job in Anacron messages, and as the name for the job's timestamp file.
The command can be any shell command.
Fields are separated by blank spaces or tabs.
period_name can only be set to monthly at the present time. ensures jobs are only run once a month, no matter the number of days in this month, or the previous month.

Environment assignment lines

VAR = VALUE

Spaces around VAR are removed.
No spaces around VALUE are allowed (unless they are to be part of the value).
The assignment takes effect from the next line to the end of the file, or to the next assignment of the same variable. Comment lines begin with # and blank lines are permitted. Continuation lines end with a \.


anacron jobs in raspberry pi

as of 12/15/19

cat /etc/anacrontab

SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
HOME=/root
LOGNAME=root

# These replace cron's entries
1            5   cron.daily  run-parts --report /etc/cron.daily
7           10  cron.weekly  run-parts --report /etc/cron.weekly
@monthly    15  cron.monthly run-parts --report /etc/cron.monthly 

/etc/cron.d:
-rw-r--r--  285 May 29  2017 anacron
-rw-r--r--  822 Jun 22 15:40 atsar

/etc/cron.daily:
-rwxr-xr-x   311 May 29  2017 0anacron
-rwxr-xr-x  1474 Sep 13  2017 apt-compat
-rwxr-xr-x   314 Apr 18  2017 aptitude
-rwxr-xr-x   355 Oct 25  2016 bsdmainutils
-rwxr-xr-x  1597 Feb 22  2017 dpkg
-rwxr-xr-x  2211 Apr 13  2014 locate
-rwxr-xr-x    89 May  5  2015 logrotate
-rwxr-xr-x  1065 Dec 13  2016 man-db
-rwxr-xr-x  1386 Feb 15  2018 ntp
-rwxr-xr-x   249 May 17  2017 passwd

/etc/cron.hourly:
-rwxr-xr-x  191 Feb 22  2012 fake-hwclock

/etc/cron.monthly:
-rwxr-xr-x  313 May 29  2017 0anacron

/etc/cron.weekly:
-rwxr-xr-x  312 May 29  2017 0anacron
-rwxr-xr-x  723 Dec 13  2016 man-db
:



See

cron(8), tzset(3)