0

I have a cron job that I want to run just once a day (executes a rake task), but while I'm testing it I have it set to run every 5 minutes. It was running perfectly fine this morning and sending me e-mails with the output but it has inexplicably stopped sending me mail.

When I checkout /var/log/syslog I can see that the cron job is still running, but the line that normally shows an email being sent has stopped appearing.

When I run service postfix status I get postfix is running.

I haven't changed the cron job itself. I still have this:

MAILTO="myemail@gmail.com"
*/5 * * * * cd /u/apps/myapp/current && /usr/local/bin/rake my_task RAILS_ENV=staging

No idea what's going on here. Any ideas?

sixty4bit
  • 141
  • 1
  • 6
  • 1
    Look at your mail logs ? – user9517 Aug 11 '14 at 17:35
  • 2
    If there is no output from the job, cron doesn't send email. – Fred the Magic Wonder Dog Aug 11 '14 at 17:44
  • According to `/var/log/mail.log` the last e-mail was sent at 10:00 AM and then it just stops – sixty4bit Aug 11 '14 at 17:45
  • That was it, @FredtheMagicWonderDog. I had made a change to the rake task that was producing no output. Do you want to add that as the answer so I can give you credit? – sixty4bit Aug 11 '14 at 17:52
  • I may have missed it, but I looked through the linked question and I do not see the answer that is explicitly relevant to this question ("If there is no output from the job, cron doesn't send email") stated anywhere – sixty4bit Aug 11 '14 at 18:08
  • It was implied by `... By default cron will mail any output from the command to the user`, I have fixed it to explicitly state that there needs to be output for mail to be generated. – user9517 Aug 11 '14 at 18:32

0 Answers0