Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have big trouble with cron. On Debian 6, it is ignoring the MAILTO variable. Is there some other variable that has to be to set for cron to send emails to a different email address then local root?

I just added MAILTO=user@hostname to /etc/crontab, restarted cron, then restarted the entire machine. Still, the mail daemon is receiving root as recipient.

Edit:

This is what comes from cron:

From: root (Cron Daemon)
To: root
Subject: Cron <root@core>   [ -x /usr/lib/php5/maxlifetime ] && [ -d /var/lib/php5 ] && find /var/lib/php5/ -type f -cmin +$(/usr/lib/php5/maxlifetime) -delete
Content-Type: text/plain; charset=UTF-8
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <HOME=/root>
X-Cron-Env: <PATH=/usr/bin:/bin>
X-Cron-Env: <LOGNAME=root>

And the exec line:

-i -FCronDaemon -oem root
share|improve this question
1  
Which cron implementation are you using? Debian has more than 1 cron packages. –  manatwork Mar 12 '12 at 11:37
    
@manatwork The default. Whatever that is. –  Let_Me_Be Mar 12 '12 at 11:54
    
Can you send email to that address from the command line (ie using "mail user@hostname")? –  Paul Tomblin Mar 12 '12 at 12:44
    
There is the X-Cron-Env: header in mails from cron. If there is the correct MAILTO=..., the error needs to be somewhere else. For me, with postfix as mail system on Debian 6, MAILTO in /etc/crontab seems to work correctly. –  jofel Mar 12 '12 at 12:53
    
@PaulTomblin Yes, the only troublesome daemon right now is CRON. –  Let_Me_Be Mar 12 '12 at 13:00
show 2 more comments

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.