Page 1 of 1

no mail from cron

Posted: Mon Jan 21, 2019 7:43 pm
by jamma
Hi there,

I've set up a Zimbra server for a local initiative. We're quite pleased with it.

I've also set up a backup script and noticed that I'm not getting any e-mail from cron. The system runs on "CentOS Linux release 7.6.1810 (Core)", Zimbra version is "8.8.10_GA_3716.FOSS". Crond is provided by "cronie-1.4.11-20.el7_6.x86_64".

On another server I had to install mailx so cron could send me mail, but that did not help here. I'm not getting any mail from cron. Example crontab (/etc/cron.d/backup-system):

Code: Select all

SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin;/opt/zimbra/common/sbin/;/opt/zimbra/common/bin
MAILTO=admin@buerger-meissen.de

12 3 * * * root /root/backup-system.sh
28 20 21 1 * root echo "test mail from cron"
The cronjobs are executed just fine: (excerpt from /var/log/cron)
Jan 21 20:28:01 bi crond[3395]: (*system*) RELOAD (/etc/cron.d/backup-system)
Jan 21 20:28:02 bi CROND[21593]: (zimbra) CMD (/opt/zimbra/libexec/zmstatuslog > /dev/null 2>&1)
Jan 21 20:28:02 bi CROND[21594]: (root) CMD (echo "test mail from cron")
Jan 21 20:28:02 bi CROND[21589]: (root) CMDOUT (test mail from cron)
Jan 21 20:30:01 bi CROND[23019]: (zimbra) CMD (/opt/zimbra/libexec/zmlogprocess > /tmp/logprocess.out 2>&1)
But no mail from cron anywhere. No error either (not in cron's log, not in /var/log/maillog).

I also tried symlinking /opt/zimbra/common/sbin/sendmail to /usr/sbin - no effect.

Any hints, ideas and pointers are welcome!

Re: no mail from cron

Posted: Wed Jan 23, 2019 11:00 pm
by Jordack
I had a similar issue. Don’t remember the actual fix, sorry for not being more useful. If I recall; the mail was stuck in the queue.

The postfix log gave me more insight on why it was getting denied.

Re: no mail from cron

Posted: Wed Feb 13, 2019 8:54 pm
by jamma
After lots of head-scratching I figured it out: cronie needs to find a /usr/sbin/sendmail on startup and doesn't provide any helpful error messages whatsoever.

Aftr all, this worked:
ln-s /opt/zimbra/common/sbin/sendmail /usr/sbin
systemctrl restart crond

Re: no mail from cron

Posted: Sat Feb 16, 2019 3:33 pm
by Jordack
That’s for the update and the fix.

Re: no mail from cron

Posted: Mon Oct 19, 2020 7:40 pm
by davidkillingsworth
Thanks for this.

I was actually trying to get my root cron jobs to generate mail so that I would get notifications for my Letsencrypt renewal script.

I found that there was an old symlink that didn't exist anymore that pointed to /opt/zimbra/postfix/sbin/sendmail. This is an artifact of an old zimbra version.

You can run this command with the "f" switch to force the symlink to be overwritten. I'm just correcting your syntax slightly as you have some typo.

Code: Select all

$ sudo ln -sf /opt/zimbra/common/sbin/sendmail /usr/sbin/sendmail
$ sudo service  cron restart
This is tested on Ubuntu 14.04 LTS and Zimbra Release 8.8.15.GA.3829.UBUNTU14.64 UBUNTU14_64 FOSS edition, Patch 8.8.15_P14.