[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: How anacron get started?



* solitone <solitone@mail.com> [160712 15:12]:
> Ok, that's clear now. Do you have any clues regarding my other questions?

* solitone <solitone@mail.com> [160712 12:50]:
> Here's what I've found in my syslog:
> 
> > 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
                        ^^^^^^^^^^^^^^^^^^
BTW, if you install postfix and configure it for "local mail only", you
will get an email with the output from backup2l, including any errors
(like disk full!).  There are other alternatives to postfix for this.

> > 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)
> 
> What other configuration files does cron take into account?

cron looks at /etc/crontab and the files in /etc/cron.d/.  /etc/crontab
has entries that, if anacron is not installed, will run the commands in
the /etc/cron.*/ directories for daily, weekly, and monthly.  The hourly
directory is run by cron, not anacron.

> Besides, why
> anacron says "0 jobs run",
> when at least one job (zz-backup2l) is in fact run?

Because anacron determined that it had already run backup2l today, so it
didn't need to run it again (see the entries at 07:05:30).

Examine the three files /etc/crontab, /etc/cron.d/anacron, and
/etc/anacrontab.  cron runs continuously.  It performs everything in
/etc/crontab and /etc/cron.d/*, but the lines in crontab that are
guarded by "test -x /usr/sbin/anacron" are skipped (cron.daily,
cron.weekly, and cron.monthly) because /usr/sbin/anacron is an
executable file.

anacron is run daily by cron because of /etc/cron.d/anacron.  anacron
schedules its own run of the daily, weekly, and monthly directories.
anacron is also started from /etc/rc2.d/S03anacron when the computer
boots, so if the computer was off when cron would have run daily,
weekly, or monthly, anacron catches it at that time (that is the primary
purpose of anacron).

Note that the logs are rotated during the daily run, so the following
might have more info:

$ sudo cat /var/log/syslog.1 /var/log/syslog | grep cron

...Marvin


Reply to: