crontab still sending emails even with > /dev/null

Posted by user2344668 on Super User See other posts from Super User or by user2344668
Published on 2014-05-09T20:39:16Z Indexed on 2014/06/11 15:31 UTC
Read the original article Hit count: 180

Filed under:
|
|

I have a crontab (root) that runs a script and output is set to > /dev/null but I always get the emails whenever it runs. I only want to receive error emails.

# Rackspace driveclient update (12pm MST)
0 12 * * * /root/scripts/driveclient-update > /dev/null

The only way I can get it to turn off is to use > /dev/null 2>&1 but then I won't get error emails. This is happening on three different CentOS servers, two are 6.3 and one is 6.4.

NOTE: I have read over and over that > /dev/null is supposed to send stdout there and prevent the email if there is nothing but stdout from the script, so at works for at least some people; I cannot figure out why it is not working on these servers.

Here's an example of where > /dev/null is supposed to work:

http://www.alphadevx.com/a/384-Suppressing-Cron-Job-Email-Notifications

© Super User or respective owner

Related posts about linux

Related posts about email