Go Back   The macosxhints Forums > OS X Help Requests > UNIX - General



Reply
 
Thread Tools Rate Thread Display Modes
Old 05-22-2005, 01:33 AM   #1
cpragman
All Star
 
Join Date: Jan 2004
Location: Limerick, PA
Posts: 858
Stop Cron from mailing messages

I've found tons of undelivered cron messages in my /var/spool/clientmqueue folder (from Jaguar), and now panther seems to be stuffing them into /Var/spool/postfix/maildrop.

I cleaned 17GB out of /var/spool/clientmqueue last night. This has got to stop.

I know I can enable sendmail and configure forwarding for root to pass these along to a regular mail account, but I'd rather not bother.

I'd like to make cron stop mailing these notices. I see that I can edit my crontab file to add the variable "MAILTO=" and it will stop.

This seemed to work for ROOT, but when I try to edit my own user crontab file (crontab -e), I get an error message that makes no sense.

Code:
"/tmp/crontab.FRHPisVp3G":1: bad minute
crontab: errors in crontab file, can't install
I don't get it. I can change this file in all kinds of ways without error, but as soon as I add the "MAILTO=" line, it throws this error.

Any ideas what I'm doing wrong?

Last edited by cpragman; 05-22-2005 at 07:59 PM.
cpragman is online now   Reply With Quote
Old 05-22-2005, 04:35 PM   #2
voldenuit
League Commissioner
 
Join Date: Sep 2003
Location: Old Europe
Posts: 5,146
How about redirecting stderr and stdout to /dev/null ?

That's how I do it, I didn't even know about the trick you try to use.
voldenuit is offline   Reply With Quote
Old 05-22-2005, 05:45 PM   #3
ajp
Triple-A Player
 
Join Date: Oct 2003
Location: Philadelphia, PA, USA
Posts: 80
why have the mailto variable set at all. remove or comment it out and see what happens.
ajp is offline   Reply With Quote
Old 05-22-2005, 08:04 PM   #4
cpragman
All Star
 
Join Date: Jan 2004
Location: Limerick, PA
Posts: 858
ajp,

There is no "MAILTO=" parameter set by default in the system's crontab file, you have to add it manually. According to "man 5 crontab", cron automatically generates a mail message to the user spawning the job. That means that on my system, I can count on a couple of root jobs a day, plus numerous user jobs per day. Adds up quickly.

If the MAILTO= parameter is provided with a username , the mail goes to that user. If the "MAILTO=" is provided with no user name, then no mail is generated (i.e., black hole).

The REAL problem I'm having is that the system's crontab (i.e., /etc/crontab) accepts the "MAILTO=" variable, yet for some reason my user's crontab filed (edited with "crontab -e") refuse to accept any file I provide that has "MAILTO=" in it.
cpragman is online now   Reply With Quote
Old 05-23-2005, 08:15 AM   #5
cpragman
All Star
 
Join Date: Jan 2004
Location: Limerick, PA
Posts: 858
I solved this one last night.

The correct syntax to add to the crontab file is as follows:

Code:
MAILTO=""
My problem was that I left out the empty quotes. Once I fixed that, no new messages were added to /var/spool/postfix/maildrop.
cpragman is online now   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



All times are GMT -5. The time now is 05:41 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.