cancel
Showing results for 
Search instead for 
Did you mean: 

crontab without mail

 
Tonatiuh
Super Advisor

crontab without mail

Red Hat Enterprise Linux AS 3U6

Every time a shell script is executed trhough a crontab, it sends a mail to /var/mail/oracle

Is there any way to avoind this mail sending?
3 REPLIES
Ivan Ferreira
Honored Contributor

Re: crontab without mail

Set your cron job like this:

5 * * * 1 /path/to/script > /dev/null 2>&1

Or set the MAILTO variable to null:

MAILTO=

Preferred method is the first.
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
Steven E. Protter
Exalted Contributor

Re: crontab without mail

Shalom,

Very interesting. A simple read/post of crontab -l will show that the cron schedule was directing its output to mail.

This was not done automatically, it was configured with the help of a human.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Stuart Browne
Honored Contributor

Re: crontab without mail

No, cron will redirect STDOUT from any jobs executed via email to the owning user.

As far as I am aware, it always has. It has to be overwritten with the MAILTO environment variable set within the cronjob it's self (as Ivan has said).
One long-haired git at your service...