Privacy Policy
© 2026 linux101.dev

anacron Command Cheatsheet

anacron is a scheduler for systems that are not always running. It guarantees daily/weekly/monthly jobs run even after downtime.

What is anacron

Used on laptops and desktops where cron may miss scheduled jobs if the machine is powered off. anacron records last run timestamps in /var/spool/anacron and executes overdue jobs at startup.

Default config file

Typical location: /etc/anacrontab

# period    delay   job-identifier  command
1 5 cron.daily nice run-parts /etc/cron.daily
7 10 cron.weekly nice run-parts /etc/cron.weekly
30 15 cron.monthly nice run-parts /etc/cron.monthly
  • period: number of days between runs (1,7,30)
  • delay: start delay in minutes after anacron
  • job-identifier: unique name that determines the timestamp file
  • command: command to execute

Standard anacron usage

The canonical distro setup keeps anacrontab small by using three jobs: cron.daily, cron.weekly, cron.monthly. The actual scripts are in /etc/cron.daily etc., and anacron runs them post-boot.

nice run-parts /etc/cron.daily means:

  • nice: reduce scheduler priority (be less aggressive).
  • run-parts: execute every executable script in the directory.

Common anacron commands

sudo anacron -f

Force-run all jobs now (ignores timestamps).

anacron -n

Run jobs without delay (non-daemon mode).

anacron -S /etc/anacrontab

Extract commands from config (useful for debugging) with no execution.

anacron -t /etc/anacrontab -f

Run using alternative config path.

anacron vs cron

  • cron schedules min/hour/day+ with fine granularity; requires daemon always running.
  • anacron schedules only day-based jobs (days, weeks, months); recovers after downtime.
  • cron uses user crontab; anacron uses system config /etc/anacrontab, normally root-owned.
  • anacron is not suitable for per-minute tasks.

Troubleshooting & tips

  • Check status with systemctl status anacron on systemd systems.
  • Verify history path: /var/spool/anacron has timestamp files per job.
  • Use anacron -f for testing to avoid waiting for period.
  • Keep anacron and cron job definitions in lockstep to avoid duplication.