View Full Version : Cron job mail!?
Hi there,
I have set a cronjob every 5 minutes and getting emails every 5 minutes .. =(
How do I make it so that I do not get these emails?? I am overflowed with these emails now .. =( ..
Tino Didriksen
2003-09-30, 06:58 AM
If a cron job has any output, it'll send that to the user the cron job is run as.
Make sure the script does not output anything...there are various ways of doing this depending on what language it's in.
knightfoo
2003-09-30, 07:59 AM
Originally posted by 2maz
Hi there,
I have set a cronjob every 5 minutes and getting emails every 5 minutes .. =(
How do I make it so that I do not get these emails?? I am overflowed with these emails now .. =( ..
You can set up your crontab entry like this:
* 5 * * * some_command 2>/dev/null >/dev/null
That will redirect all standard output and standard error to /dev/null
If you do not want mail for *any* of your crontabs (may be dangerous) you can add this to the top of your crontab file:
MAILTO=""
I normally set up my scripts to handle mailing their own errors if it is needed, but crontab will let you know if your script bombs completely by mailing the error output. It is a good idea to modify your scripts so that it only creates output when you really need to see what happened.
-knightfoo
vBulletin® v3.6.8, Copyright ©2000-2008, Jelsoft Enterprises Ltd.