1
$ grep anacron /var/log/syslog
Feb 20 19:05:11 jesus-Custom-PC anacron[1410]: Anacron 2.3 started on 2016-02-20
Feb 20 19:05:11 jesus-Custom-PC anacron[1410]: Normal exit (0 jobs run)
Feb 20 19:05:13 jesus-Custom-PC anacron[2022]: Anacron 2.3 started on 2016-02-20
Feb 20 19:05:13 jesus-Custom-PC anacron[2022]: Normal exit (0 jobs run)

As you see anacron starts but does not run cron.daily nor informs that it will be run with some delay.

I have tried to do $ grep 19:05 /var/log/syslog in order to search for errors but no errors between anacron start and exit.

Cron logs:

$ grep CRON /var/log/syslog
Feb 20 19:05:11 jesus-Custom-PC cron[1263]: (CRON) INFO (pidfile fd = 3)
Feb 20 19:05:11 jesus-Custom-PC cron[1417]: (CRON) STARTUP (fork ok)
Feb 20 19:05:11 jesus-Custom-PC cron[1417]: (CRON) INFO (Running @reboot jobs)
Feb 20 19:09:01 jesus-Custom-PC CRON[3390]: (root) CMD (  [ -x /usr/lib/php5/maxlifetime ] && [ -x /usr/lib/php5/sessionclean ] && [ -d /var/lib/php5 ] && /usr/lib/php5/sessionclean /var/lib/php5 $(/usr/lib/php5/maxlifetime))
Feb 20 19:17:01 jesus-Custom-PC CRON[3945]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
Feb 20 19:20:01 jesus-Custom-PC CRON[3965]: (smmsp) CMD (test -x /etc/init.d/sendmail && /usr/share/sendmail/sendmail cron-msp)
Feb 20 19:39:01 jesus-Custom-PC CRON[4205]: (root) CMD (  [ -x /usr/lib/php5/maxlifetime ] && [ -x /usr/lib/php5/sessionclean ] && [ -d /var/lib/php5 ] && /usr/lib/php5/sessionclean /var/lib/php5 $(/usr/lib/php5/maxlifetime))
Feb 20 19:40:01 jesus-Custom-PC CRON[4219]: (smmsp) CMD (test -x /etc/init.d/sendmail && /usr/share/sendmail/sendmail cron-msp)
Feb 20 20:00:01 jesus-Custom-PC CRON[4569]: (smmsp) CMD (test -x /etc/init.d/sendmail && /usr/share/sendmail/sendmail cron-msp)
Feb 20 20:09:01 jesus-Custom-PC CRON[4770]: (root) CMD (  [ -x /usr/lib/php5/maxlifetime ] && [ -x /usr/lib/php5/sessionclean ] && [ -d /var/lib/php5 ] && /usr/lib/php5/sessionclean /var/lib/php5 $(/usr/lib/php5/maxlifetime))
Feb 20 20:17:01 jesus-Custom-PC CRON[4843]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
Feb 20 20:20:01 jesus-Custom-PC CRON[4939]: (smmsp) CMD (test -x /etc/init.d/sendmail && /usr/share/sendmail/sendmail cron-msp)
Feb 20 20:39:01 jesus-Custom-PC CRON[5407]: (root) CMD (  [ -x /usr/lib/php5/maxlifetime ] && [ -x /usr/lib/php5/sessionclean ] && [ -d /var/lib/php5 ] && /usr/lib/php5/sessionclean /var/lib/php5 $(/usr/lib/php5/maxlifetime))
Feb 20 20:40:01 jesus-Custom-PC CRON[5470]: (smmsp) CMD (test -x /etc/init.d/sendmail && /usr/share/sendmail/sendmail cron-msp)

Anacrontab:

$ cat /etc/anacrontab 
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

Cron table:

$ cat /etc/crontab
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 )

Forcing to run anacron the scripts are executed correctly:

$ sudo anacron -fnd
Anacron 2.3 started on 2016-02-20
Will run job `cron.daily'
Will run job `cron.weekly'
Will run job `cron.monthly'
Jobs will be executed sequentially
Job `cron.daily' started
...
2
  • also grep for errors in syslog ;-)
    – Rinzwind
    Commented Feb 20, 2016 at 21:46
  • @Rinzwind I have tried but I have not found any error. Commented Feb 20, 2016 at 22:08

1 Answer 1

0

I do not know why it was not executing jobs but today morning I have seen this:

Feb 21 11:55:22 jesus-Custom-PC anacron[1398]: Job `cron.daily' terminated
Feb 21 11:55:22 jesus-Custom-PC anacron[1398]: Job `cron.weekly' started
Feb 21 11:55:22 jesus-Custom-PC anacron[5148]: Updated timestamp for job `cron.weekly' to 2016-02-21
Feb 21 11:55:24 jesus-Custom-PC anacron[1398]: Job `cron.weekly' terminated
Feb 21 11:55:24 jesus-Custom-PC anacron[1398]: Normal exit (2 jobs run)

So I think it is working.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .