0

RHEL8 system here. Outputs from /etc/cron.daily... produce the expected email output, but my user's own crontab doesn't. Here's a test that sums up my problem:

~$ crontab -l
MAILTO=dh
 *  *     * * * echo "HERE"
~$ sudo tail /var/log/cron
[sudo] password for dh:
Nov  6 08:33:42 deham01lx013 crond[2177]: (dh) RELOAD (/var/spool/cron/dh)
Nov  6 08:34:01 deham01lx013 CROND[3503836]: (dh) CMDOUT (HERE)
Nov  6 08:34:13 deham01lx013 crontab[3503855]: (dh) LIST (dh)

FWIW, the mails from the root cron jobs are correctly mailed to "dh" via an alias in /etc/aliases. Also when I do ~$ echo "HELLO" | mail dh, I get the mail. The cron daemon isn't running with any weird options, either:

~$ ps afx | grep cron
   2177 ?        Ss     0:12 /usr/sbin/crond -n

Any hints?

4
  • Does removing MAILTO=dh make things better? The default is to mail any output to the owner of the schedule, so you should not need to specify an explicit MAILTO address. I'm wondering if doing so is confusing something.
    – Kusalananda
    Commented Nov 6, 2023 at 8:41
  • Does MAILTO=root work better? I guess you have a local sendmail (or any other MTA/MDA), what do its logs say?
    – xhienne
    Commented Nov 6, 2023 at 10:33
  • MAILTO=root or no mailto at all don't make a difference. Neither does using stderr echo "HERE" 1>&2 instead of sdout. The cron log shows correct execution of the command, see original post.
    – musbur
    Commented Nov 6, 2023 at 11:29
  • This crontab entry: ` * * * * * echo "HERE" | mail dh` diligently sends me a mail every minute. So I could just hang a "mail pipe" to all my crontab entries, but that seems silly.
    – musbur
    Commented Nov 6, 2023 at 11:31

1 Answer 1

0

By refining my searches more and more I did manage to find the answer here:

https://serverfault.com/questions/1114164/cron-not-sending-output-to-email-but-writing-output-var-log-cron

In short, crond had been running since before I installed mailx so it just wasn't aware that there was a mail service available. Fixed.

You must log in to answer this question.

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