Tired of getting too many emails from cron daemon? Here is a simple solution of letting cron send you an email when something goes wrong.
sudo crontab -e
Set "MAILTO=" on top of yout first command to be executed. And add ">/dev/null" to the end of each command.
Here is my example:
#run emen2 local backup everyday at 1am and sync with production server everyday at 3am
MAILTO=your_email_address
0 1 * * * /home/user/cronjobs/emen2_backup.sh > /dev/null
0 3 * * * /home/user/cronjobs/syncserver.sh > /dev/null
Restart cront using command
sudo /etc/init.d/cron restart
Here is a very good example of explaing what
/dev/null
mean?
No comments:
Post a Comment