Should you use cron or anacron on a machine that isn't always on?

By TechCompare · Updated · How we check

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.

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 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.' When anacron starts, each due job waits for its configured delay and then runs independently of other jobs by default. The -s option serializes jobs, while -n starts due jobs immediately and also implies serial execution.

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 runs after the machine becomes available again. Modern Linux distributions typically run both: cron handles minute-level precision for always-on jobs, and anacron catches up daily, weekly, and monthly maintenance tasks.

Verdict

Use cron on machines that stay on and anacron on machines that don't. Anacron works in day units only, with no minute or hour fields. Due jobs run independently after their own delay by default, and become sequential only with -s or -n.

A laptop that sleeps overnight misses the cron slot entirely, but anacron catches the daily backup. Mainstream distros run both, so cron covers minute-level jobs and anacron covers the day-based jobs.

More Cron scenarios

Every 5 minutes
Running a cron job every 5 minutes uses the step operator in the minute field: */5 * * * *.
View details
Every hour
To run a job at the top of every hour, use 0 * * * *.
View details
Daily at midnight
0 0 * * * runs a job at exactly midnight (00:00) every day.
View details

Frequently asked questions

What's the difference between cron and anacron?
Cron assumes the machine is on and awake at the scheduled time, and a machine that was off simply misses the job. Anacron tracks when each job last ran and executes the overdue ones after boot. The trade: anacron schedules in day units only, so you can say 'daily' or 'weekly' but never '2:15 AM.'
Why did my cron job not run on my laptop overnight?
Because the laptop was asleep or powered off, and cron has no concept of catching up. A 0 2 * * * backup on a machine that's closed at 2 AM just never fires. On laptops, desktops, and spot instances that come and go, anacron is the right scheduler: it runs the missed daily job shortly after you open the lid.
Can cron and anacron run side by side on the same machine?
Yes, and most mainstream Linux distributions do exactly that. Cron handles minute-precision jobs that need exact wall-clock timing. Anacron covers the daily, weekly, and monthly maintenance (logrotate, man-db updates, package caches) so those still happen even if the machine was off at the nominal time. They complement each other rather than compete.