1

Since I upgraded to Civi 5.11 (from 4.7) I am seeing empty emails from the cron daemon every time it runs the scheduled jobs. Previously I have only had emails when there has been some issue with the cron or what looks like an error from one of the scheduled jobs. The scheduled jobs look to all be fine in the log.

The problem is that it would hide any genuine error messages as I'm not going to go through all these emails.

Running on Wordpress 5.1.1 hosted on Siteground.

Update: I still want to resolve this. Part of the problem is I don't know where the messages with some content are coming from - they are all

"/usr/sbin/sendmail: unexpected response 501 to RCPT TO command"

I don't know exactly what they mean, but they did relate to a genuine problem with delivering mail. So I'd like to keep them. But they are few and far between and I haven't seen one for ages (maybe because there haven't been any bulk mailings). If I divert stdout to /dev/null will I lose the good as well as the bad. Not sure how to test it.

7
  • Update: I still want to resolve this. Part of the problem is I don't know where the messages with some content are coming from - they are all "/usr/sbin/sendmail: unexpected response 501 to RCPT TO command" I don't know exactly what they mean, but they did relate to a genuine problem with delivering mail. So I'd like to keep them. But they are few and far between and I haven't seen one for ages (maybe because there haven't been any bulk mailings). If I divert stdout to /dev/null will I lose the good as well as the bad. Not sure how to test it.
    – Mick Kahn
    Commented Jul 8, 2019 at 23:18
  • 1
    The 501's are probably emails in civi that are badly formatted, e.g. "[email protected] / [email protected]". For the original problem where you started receiving blank emails with every cron run it suggests something in civi or an extension is outputting some whitespace. If you run cron manually and redirect to a file and then examine the contents with a binary editor, or even just pipe it through od then you can confirm if that's what's happening, e.g. your-cron-command | od -c. It might be something like an extra blank line was added in your wp-config file or civicrm.settings.php.
    – Demerit
    Commented Jul 9, 2019 at 0:04
  • Demerit - thanks - pointing me in the right direction. Running manually has shown that cron is producing a newline character (x0A) and presumably it wasn't before. Can't see that the config files will do this but will look at them. But I think my work round will just be to append all the cron output to a file and look at that once a week to see if there are any real errors.
    – Mick Kahn
    Commented Jul 10, 2019 at 20:25
  • Demerit - I think the sendmail errors are probably for a separate question, but they aren't badly formed addresses. I can't see any pattern yet in what could cause them and (fortunately) I haven't seen any for a while.
    – Mick Kahn
    Commented Jul 10, 2019 at 20:28
  • If you can't find where the newline is coming from, then one possibility is alter your cron command slightly: your-cron-command | grep ".", which will remove all blank lines from the output, so if the output is just a newline then after it will be completely empty and not send an email as normal. In some hosting control panels you might need to backslash the pipe character, or create a wrapper script and have cron call that script.
    – Demerit
    Commented Jul 10, 2019 at 22:25

1 Answer 1

1

This turned out to be something adding a blank line in the cron output (see comments above). Since it's not clear what is adding it or how to track it down, a workaround is to adjust the cron command slightly:

your-cron-command | grep "."

which will remove all blank lines from the output, so if the output is just a newline then after the grep the output will be completely empty and not send an email as normal. In some hosting control panels you might need to backslash the pipe character, or create a wrapper script and have cron call that script.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.