I was reading about the differences between cron and anacron and I realized that anacron, unlike cron is not a daemon. So I'm wondering how does it work actually if it's not a daemon.
It uses a variety of methods to run:
- if the system is running systemd, it uses a systemd timer (in the Debian package, you’ll see it in
- if the system isn’t running systemd, it uses a system cron job (in
- in all cases it runs daily, weekly and monthly cron jobs (in
- it also runs at boot (from
/etc/init.d/anacronor its systemd unit).
anacron is not a daemon, and therefore it needs to be run periodically by other means. Most often, this means executing it with a cron job once a day, and possibly on bootup as well.
This may look like the following in root's crontab, for example:
@reboot /usr/local/sbin/anacron -ds @daily /usr/local/sbin/anacron -ds
Linux systems that uses systemd may do this differently, obviously, but still need to facilitate at least one run of
anacron per 24 hour period.
anacron more than once every 24 hours is pointless as the shortest period one can schedule jobs through
anacron is once a day.