2

I have this line in my /etc/crontab:

47 6    * * Sat root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )

So the cron.weekly should be started every Saturday at 6:47 AM right? But it starts each Wednesday instead. I restarted the cron service. What am I doing wrong? Thanks.

Flup
  • 7,978
  • 2
  • 32
  • 43
valk
  • 497
  • 2
  • 9
  • 20
  • 2
    Might sound like a silly question, but... is the date and time set correctly? :) – Flup Jul 15 '14 at 07:27
  • not silly, but I wouldn't ask this without checking that :) so the date is correct, the output is today – valk Jul 15 '14 at 07:33
  • 2
    Does this system run continuously ? – user9517 Jul 15 '14 at 07:37
  • @Iain, yes, for at least 4 months.. – valk Jul 15 '14 at 08:00
  • What's weird's - that the logs also verify that, here's the last run line for example: `Jul 9 07:57:44 Server anacron[31511]: Job 'cron.weekly' started`. So the hour is obviously wrong. I'm wondering, could be there any other setting which overrides the `/etc/crontab` ? Thanks. – valk Jul 15 '14 at 08:04
  • There is no need to wonder - the log messages tells you what is happening. – user9517 Jul 15 '14 at 08:20
  • 1
    Your cron isn't being run by cron. It's being run by anacron. anacron runs crontabs that aren't run by cron. Does your system have an anacron job scheduled for cron.weekly? If not, anacron probably doesn't know that the weekly cron is being run successfully (the anacron job in cron.weekly normally informs anacron that the regular cron job was run). – hrunting Jul 16 '14 at 02:34
  • 1
    @hrunting read the cron job. The cron.weekly job only gets run if anacron isn't available... Read the comment with the log message in. The system is working as designed. – user9517 Jul 16 '14 at 06:14
  • 2
    @Iain you're right, I missed that. Cron's working as specified, although it appears it's not quite as valk wishes it were designed. Anacron runs the cron (which isn't necessarily going to happen on cron's schedule). – hrunting Jul 17 '14 at 02:44
  • I made a lots of googling, and found that if there exists Anacron on the system, then it overrides the cron's settings!! So I went to anacron's last run file located at /var/spool/anacron/cron.weekly and changed the value to last Saturday. So today it finally ran! My question is how do I set also the time, so it'll run on 6:47? @hruntig was right about it. But what is my best option here? To disable anacron maybe? – valk Aug 16 '14 at 09:41

0 Answers0