Cron Fundamentalsintermediate

What is Anacron?

A cron alternative that runs missed scheduled jobs when the system comes back online.

Definition

Anacron (anachronistic cron) is a periodic command scheduler that does not assume the system is running continuously. If a scheduled job was missed because the system was powered off or asleep, anacron runs it when the system next starts. Unlike cron, anacron only handles daily or longer intervals (not hourly or minutely). It uses /etc/anacrontab for configuration, with each entry specifying a period in days, a delay in minutes, a job identifier, and a command.

๐Ÿ’ก

Simple Analogy

Like a personal assistant who checks your to-do list every morning โ€” if you were away yesterday, they catch up on anything you missed before starting today's tasks.

Why It Matters

Laptops, development machines, and intermittently connected servers frequently miss cron jobs because the system was off or asleep at the scheduled time. Anacron ensures critical maintenance tasks โ€” log rotation, backups, package updates โ€” still execute. For always-on servers, cron is sufficient, but for any system with downtime, anacron provides essential catch-up scheduling.

How to Verify

Check if anacron is installed with "which anacron" or "anacron -V". View its configuration at /etc/anacrontab. The timestamps in /var/spool/anacron/ show when each job last ran. On modern systems, anacron is often triggered by cron itself via /etc/cron.daily/0anacron.

โš ๏ธ

Common Mistakes

Relying on anacron for minute or hour-level scheduling โ€” it only supports daily or longer periods. Assuming anacron replaces cron entirely โ€” they are complementary tools. Not setting appropriate delays between anacron jobs, causing all missed tasks to run simultaneously at boot.

โœ…

Best Practices

Use anacron for daily maintenance tasks on systems that may not run 24/7 (laptops, dev servers). Keep cron for always-on production servers and minute/hour-level scheduling. For critical production jobs, use CronJobPro which handles missed schedules automatically with configurable retry policies.

Cron Expression Generator

Build your cron expression

Try it free โ†’

Frequently Asked Questions

What is Anacron?

Anacron (anachronistic cron) is a periodic command scheduler that does not assume the system is running continuously. If a scheduled job was missed because the system was powered off or asleep, anacron runs it when the system next starts. Unlike cron, anacron only handles daily or longer intervals (not hourly or minutely). It uses /etc/anacrontab for configuration, with each entry specifying a period in days, a delay in minutes, a job identifier, and a command.

Why does Anacron matter for cron jobs?

Laptops, development machines, and intermittently connected servers frequently miss cron jobs because the system was off or asleep at the scheduled time. Anacron ensures critical maintenance tasks โ€” log rotation, backups, package updates โ€” still execute. For always-on servers, cron is sufficient, but for any system with downtime, anacron provides essential catch-up scheduling.

What are best practices for Anacron?

Use anacron for daily maintenance tasks on systems that may not run 24/7 (laptops, dev servers). Keep cron for always-on production servers and minute/hour-level scheduling. For critical production jobs, use CronJobPro which handles missed schedules automatically with configurable retry policies.

Related Terms