LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

anacron

Run periodic jobs on systems not running continuously

TLDR

Run anacron jobs now
$ sudo anacron -n
copy
Run in foreground
$ sudo anacron -d
copy
Test run (don't execute jobs)
$ anacron -T
copy
Force run regardless of timestamps
$ sudo anacron -f
copy
Use specific config file
$ sudo anacron -t [/etc/anacrontab]
copy

SYNOPSIS

anacron [-s] [-f] [-n] [-d] [-t anacrontab] [-T]

DESCRIPTION

anacron is a cron-like job scheduler that doesn't assume the computer is running continuously. It's ideal for laptops and desktop machines that aren't powered on 24/7, ensuring periodic jobs run even if the scheduled time was missed.Unlike cron, which runs jobs at specific times, anacron runs jobs based on periods (daily, weekly, monthly) and tracks the last run date. If a job's period has elapsed since the last run, it executes the job.

PARAMETERS

-f

Force execution ignoring timestamps
-n
Run jobs now, ignoring delays
-d
Run in foreground (no daemon)
-s
Serialize job execution (sequential)
-T
Test configuration file syntax only
-t file
Use alternate anacrontab file
-S dir
Use alternate spool directory
-u
Update timestamps only, don't run jobs

CONFIGURATION

/etc/anacrontab

Defines periodic jobs with their period in days, delay in minutes, identifier, and command to execute.
/var/spool/anacron/
Timestamp files tracking the last execution date of each job.

INSTALL

sudo apt install anacron
copy
sudo dnf install cronie
copy
sudo pacman -S cronie
copy
sudo apk add cronie
copy
sudo zypper install cronie
copy
nix profile install nixpkgs#cronie
copy

CAVEATS

Runs as root by default; user-level jobs require additional configuration. Job delay settings are randomized to avoid resource spikes. Not suitable for time-critical tasks.

HISTORY

anacron was created by Christian Schwarz and first released in 1998 to address cron's unsuitability for machines that aren't always on. Most modern Linux distributions include it alongside traditional cron.

SEE ALSO

cron(8), crontab(1)

Braincup
Open source brain training for math, memory and focus
Braincup mini-games
41 mini-games · Apache-2.0
No ads · No tracking
Play in browser
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid
276 stars
From the maker of Linux Command Library
Copied to clipboard
Braincup
Open source brain training for math, memory and focus. 41 mini-games, from mental arithmetic to Sudoku, N-Back and Solo Chess.
Apache-2.0 licensed · No ads · No tracking · No account
From the maker of Linux Command Library
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid