July 29, 2010, 4:45 pm UTC  

Postings

Cron / Crontab – disable e-mail notifications

There are 2 ways to prevent cron to send out e-mail notifications after jobs are run:

  1. Ensure there are no output from the script(s) being run by sending the output to /dev/null
    Simply append one of the following directives to the end of your script.

    >/dev/null 2>&1.

    OR

    &> /dev/null

    Your crontab would now look something like:

    0 1 5 10 * /path/to/script.sh >/dev/null 2>&1

    OR

    0 1 5 10 * /path/to/script.sh &> /dev/null

  2. Update MAILTO variable

  3. As the e-mail notification is sent to the local account by default, it is possible to overwrite that by setting the MAILTO=”" variable within the crontab file. Simply enter the following at the start of your crontab file:

    MAILTO=”"

    so that it looks something like:

    MAILTO=”"
    0 1 5 10 * /path/to/script.sh &> /dev/null

Filed under: cli-fu — appgirl @ 7:43 am
Comments (0)

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment

About

My name is Catherine Liao and you're reading the latest postings of various blogs I follow. You'll notice that the topics tend to center around Cloud Computing, Data Center, Virtualization, Servers, Web Technologies and 24x7 Operations.

These are topics that I'm interested in as I've spent a large chunk of my professional career building, deploying, and maintaining 24x7 application delivery environments. I use the knowledge I've garnered daily in my role as a Technology Solutions Architect for Cisco. I should note that this site is my personal site and does not reflect the views of Cisco.

Feel free to drop me a note if you find this site useful or if you'd like for me to check out your blog. I can be reached at catherine.liao@gmail.com. You can also connect with me via LinkedIn or Twitter.

Looking for less "geeky" content? Check out my travel blog 1-Day Itinerary.

Tweets

Fans

AppGirl on Facebook

Powered by WordPress