Cron vs anacron: which scheduler for laptops and servers that don't run 24/7?

Cron assumes your machine runs 24/7. If the server is off at the scheduled time, the job is skipped. Anacron is designed for machines that don't run continuously: it tracks when each job last ran and executes missed jobs after boot. If your workload includes laptops, development VMs, or spot instances, anacron is the right tool.

Schedule pattern
Cron vs anacron
cron-vs-anacron
Category
Comparisons
Cron vs alternative schedulers

How this is calculated

Anacron schedules are defined in days, not minutes. You can say 'run this job daily' or 'run this weekly' but not 'run at 2:15 AM.' Anacron runs jobs in sequence after a configurable delay from boot. On a server that runs 24/7, cron is better because it gives you precise wall-clock timing. On a laptop that sleeps overnight, anacron ensures the daily backup actually happens when you open the lid in the morning. Modern Linux distributions typically run both: cron handles minute-level precision for always-on jobs, and anacron catches up daily/weekly/monthly maintenance tasks.

Verdict

Use cron for always-on servers that need precise scheduling. Use anacron for laptops, desktops, and any machine that might be powered off at the scheduled time. On a typical Linux desktop, both run side by side and the combination covers all scheduling needs.

More Cron scenarios

Frequently asked questions

What is a Cron Job?
A cron job is a scheduled task that runs automatically on a Unix-like operating system (like Linux or macOS) at specific intervals. It is heavily used by developers to run background tasks like database backups, cache clearing, or sending nightly emails.
What do the 5 parts of a cron expression mean?
From left to right, the 5 fields are: Minute (0-59), Hour (0-23), Day of the Month (1-31), Month (1-12), and Day of the Week (0-6, where 0 and 7 are Sunday).
What does the asterisk (*) mean in Cron?
The asterisk acts as a wildcard, meaning 'every'. For example, if the minute field is an asterisk, the task runs every single minute. If the month field is an asterisk, the task runs every single month.
How do I run a task every 5 minutes?
To run a task every 5 minutes, use the slash operator in the minute field like this: */5 * * * *. The */5 means 'every 5th minute'.