How does anacron work 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
/lib/systemd/system/anacron.timer
); - if the system isn’t running systemd, it uses a system cron job (in
/etc/cron.d/anacron
); - in all cases it runs daily, weekly and monthly cron jobs (in
/etc/cron.{daily,weekly,monthly}/0anacron
); - it also runs at boot (from
/etc/init.d/anacron
or 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.
Running anacron
more than once every 24 hours is pointless as the shortest period one can schedule jobs through anacron
is once a day.