Stop Cron Job emailing me notifications

Posted on 2011-10-24
Last Modified: 2012-05-12
I have set up a Cron Job in cPanel and it emails me a notification every day when Cron Job is completed. I want the Cron Job to continue but dont need a daily email from it - once a week would be fine...
Question by:TheCommander
    LVL 68

    Expert Comment

    To avaid these emails add

    >>/path/to/logfile 2>&1

    at the end of the crontab entry.

    Set up a new weekly cronjob to send the output file to you via email and to clear it afterwards.

    0 0 * * * 0 /usr/bin/mailx -s "Cron LOG" < /path/to/logfile && rm -f /path/to/logfile

    LVL 2

    Expert Comment

    in Cpanel, in the cronJobs setup page there is a text box where you can specify the destination email  that you wish the cron job to send when executed.
    all what you have to do is to leave this textbox empty, and save your settings.

    N.B: in case it is empty and you still receive emails,  recheck your script, maybe there is a function called within your script to send email when executed.

    Good luck !

    Accepted Solution

    Dont need this anymore - resloved in house.

    Author Closing Comment

    my tech guy figured and fixed.

    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    Join & Write a Comment

    As a database administrator, you may need to audit your table(s) to determine whether the data types are optimal for your real-world data needs.  This Article is intended to be a resource for such a task. Preface The other day, I was involved …
    One of the typical problems I have experienced is when you have to move a web server from one hosting site to another. You normally prepare all on the new host, transfer the site, change DNS and cross your fingers hoping all will be ok on new server…
    Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
    Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

    731 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now