How anacron get started?
I can't really understand how anacron works on my laptop. How can
anacron wake up and start every morning,
when I don't turn off my laptop?
I've setup a backup process, taking advantage of backup2l. Apparently,
when I don't shutdown my laptop,
backup2l starts every morning at 7:30 am, I suppose thanks to anacron:
> $ ls -l /etc/cron.daily/zz-backup2l
> -rwxr-xr-x 1 root root 328 Jan 4 2005 /etc/cron.daily/zz-backup2l
> $ cat /etc/anacrontab
> # /etc/anacrontab: configuration file for anacron
>
> # See anacron(8) and anacrontab(5) for details.
>
> SHELL=/bin/sh
> PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
> HOME=/root
> LOGNAME=root
>
> # These replace cron's entries
> 1 5 cron.daily run-parts --report /etc/cron.daily
> 7 10 cron.weekly run-parts --report /etc/cron.weekly
> @monthly 15 cron.monthly run-parts --report
> /etc/cron.monthly
But what triggers anacron? Looking at my crontab, it would seem it's not
cron that starts anacron:
> $ cat /etc/crontab
> # /etc/crontab: system-wide crontab
> # Unlike any other crontab you don't have to run the `crontab'
> # command to install the new version when you edit this file
> # and files in /etc/cron.d. These files also have username fields,
> # that none of the other crontabs do.
>
> SHELL=/bin/sh
> PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
>
> # m h dom mon dow user command
> 17 * * * * root cd / && run-parts --report /etc/cron.hourly
> 25 6 * * * root test -x /usr/sbin/anacron || ( cd / &&
> run-parts --report /etc/cron.daily )
> 47 6 * * 7 root test -x /usr/sbin/anacron || ( cd / &&
> run-parts --report /etc/cron.weekly )
> 52 6 1 * * root test -x /usr/sbin/anacron || ( cd / &&
> run-parts --report /etc/cron.monthly )
> #
Here's what I've found in my syslog:
> $ sudo grep cron /var/log/syslog
> Jul 12 06:25:01 aldous CRON[10672]: (root) CMD (test -x
> /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily ))
This depends on my /etc/crontab. As expected, nothing happens here.
> Jul 12 07:05:30 aldous anacron[9445]: Job `cron.daily' terminated
> (mailing output)
> Jul 12 07:05:30 aldous anacron[9445]: Can't find sendmail at
> /usr/sbin/sendmail, not mailing output
> Jul 12 07:05:30 aldous anacron[9445]: Normal exit (1 job run)
> Jul 12 07:05:30 aldous anacron[9445]: anacron: Can't find sendmail at
> /usr/sbin/sendmail, not mailing output
But now... what triggered anacron at 07:05:30?
> Jul 12 07:17:01 aldous CRON[11658]: (root) CMD ( cd / && run-parts
> --report /etc/cron.hourly)
> Jul 12 07:30:01 aldous CRON[11716]: (root) CMD (test -x
> /etc/init.d/anacron && /usr/sbin/invoke-rc.d anacron start >/dev/null)
> Jul 12 07:30:01 aldous anacron[11736]: Anacron 2.3 started on 2016-07-12
> Jul 12 07:30:01 aldous anacron[11736]: Normal exit (0 jobs run)
This time it seems it's cron that triggers anacron. But why, considering
my /etc/crontab shown above?
What other configuration files does cron take into account? Besides, why
anacron says "0 jobs run",
when at least one job (zz-backup2l) is in fact run?
I'm rather confused!
Reply to: