Saturday, August 7, 2010

How to stop crontab writing to var/spool/mail/root file

My crontab is writing to /var/spool/mail/root file... Is there anyway I can stop this? The crontab is running every minute and it would fill the mail pretty quickly.

Solutions:

 

1)

Can i see the crontab rule ?? you must of put to sent email to root
If use the crontab rule like in below example, it will not send any email


Example:
*/5 17,18 * * 1-5 /sage.sh >/dev/null 2>&1

2)

At the top of your crontab file just add:
MAILTO=""
This will disable mail sending by crond.

 

Recommended Solution:

Try to set that in the script itself rather than the whole crontab file

No comments: