at, cron, and anacron
Scheduling Commands and Scripts

© Lead Image © rawpixel, 123RF.com
The at command and the related cron and anacron can help you efficiently schedule tasks, whether one-time events or jobs to be done repeatedly.
Scheduling tasks is as old as Unix. Usually, it is a concern for root users, handy for making sure that jobs like backups are done regularly. However, scheduling can also be useful for regular users, if only to broadcast a message to themselves to take a break. Either way, you have three scheduling systems for your needs: at
[1] and its related commands, cron
[2], and anacron
[3]. The three overlap, but each has its own peculiarities for configuration and scheduling.
The at Family of Commands
At
and its associated commands are for scheduling of a one-time event. By default, the commands can only be run by root. However, other users can also be permitted to run at
if you create a file called /etc/at.allow
, adding names one per line. You can also add users to /etc/at.deny
if there are users whom you specifically do not want to use the commands, including users that exist for administrative purposes or users that might be created by intruders, such as guest
(Figure 1).
To schedule a command to run once, enter the command followed by a time. The time must be precise down to minutes and can be precise down to seconds using the MMDDhhmm[.ss]
format. You can also specify the fixed times midnight
, noon
, or teatime
(4pm) or a specific date followed by the time. Similarly, you can specify now
, today
, or tomorrow
, optionally adding a time after now
or today
. For instance, 5pm + 1 week
or noon August 2
would both be valid time entries. Should you enter a time that has already passed, such as 11am today
when it is 4pm, the command will be run in about five minutes.
[...]
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.

News
-
OpenMandriva Lx 6.0 Available for Installation
The latest release of OpenMandriva has arrived with a new kernel, an updated Plasma desktop, and a server edition.
-
TrueNAS 25.04 Arrives with Thousands of Changes
One of the most popular Linux-based NAS solutions has rolled out the latest edition, based on Ubuntu 25.04.
-
Fedora 42 Available with Two New Spins
The latest release from the Fedora Project includes the usual updates, a new kernel, an official KDE Plasma spin, and a new System76 spin.
-
So Long, ArcoLinux
The ArcoLinux distribution is the latest Linux distribution to shut down.
-
What Open Source Pros Look for in a Job Role
Learn what professionals in technical and non-technical roles say is most important when seeking a new position.
-
Asahi Linux Runs into Issues with M4 Support
Due to Apple Silicon changes, the Asahi Linux project is at odds with adding support for the M4 chips.
-
Plasma 6.3.4 Now Available
Although not a major release, Plasma 6.3.4 does fix some bugs and offer a subtle change for the Plasma sidebar.
-
Linux Kernel 6.15 First Release Candidate Now Available
Linux Torvalds has announced that the release candidate for the final release of the Linux 6.15 series is now available.
-
Akamai Will Host kernel.org
The organization dedicated to cloud-based solutions has agreed to host kernel.org to deliver long-term stability for the development team.
-
Linux Kernel 6.14 Released
The latest Linux kernel has arrived with extra Rust support and more.