Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have a CentOS based e-mail sever that runs a bunch of cron jobs. The problem I'm having is that cron is sending emails as logs and that seems to be cluttering things up. The e-mails are entering loops between the server itself and the Barracuda SPAM filter that we have, then it times out. Each e-mail loop causes ~15 log entries and each cron job runs every 5 minutes 24x7. The math isn't important, but it's a ridiculous amount of logging. I would like to stop cron from sending email completely, but can't find it. I would like to have cron output to just a local log file if possible.
@TenTenths:
Yes, I did, and I followed a link to a similar answer. I guess my question should've been "How do you universally disable cron from sending email?" rather than disabling emailing for particular cron jobs
@MartinStrec: Basically, see above. I followed your methods, but I'm looking for a universal way of telling cron "just don't send e-mail" or "output to file rather than email"
@TenTenths:
Yes, I did, and I followed a link to a similar answer. I guess my question should've been "How do you universally disable cron from sending email?" rather than disabling emailing for particular cron jobs
Sorry for my sharp response, I'm tired and forgot my first rule of never post when tired. On the example from google and Martin the MAILTO variable is your friend in this particular case. I make extensive use of it and then use other methods such as having any cron script I use do its own logging or sending of e-mail alerts.
It would indeed be an option to set it in the configuration file, but it depends whether you have the original vixie-cron where it’s not available AFAICS, or cronie. man cron should reveal it.
Background info that may help people:
CentOS 6 runs cronie
CentOS 5 runs vixie-cron
In CentOS6 cron's default behavior is to send an email to the owner of the cron job if the cron job produces any output (stdout or stderr). If the flag: MAILTO is present and has a value (in crontab or elsewhere /etc/cron.d for example) any output will be emailed the the email specified after MAILTO.
To turn off emailing use the flag -m off in /etc/sysconfig/crond:
# Settings for the CRON daemon.
# CRONDARGS= : any extra command-line startup arguments for crond
CRONDARGS='-m off'
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.