David Bogar's picture

Cron is sending lots and lots of emails (100+ a day it seems) to the root acount. I can't seem to figure out how to get it to stop! Sends the PHP warnings, and errors, ect. 

Forum: 
Tags: 
Jeremy Davis's picture

You could adjust the level of PHP reporting (so it only emails re errors - which you probably want to fix). Or you could adjust the cron job itself. Google gave a link that's probably relevant (TKL is now based on Debian but Ubuntu should be close enough for the purposes of your question).

Let us know how you go and if/how you adjusted it...

David Bogar's picture

The MAILTO="" did not work :( 

Dan Kelley's picture

Ive got the same problem. I have PHP scripts that run once a minute and the output is being sent to the users email.

I have reduced the output of the scripts, but would also like a way to just "Shut them off" 

Any ideas?

 

Jeremy Davis's picture

I suspect that there may be a setting somewhere in your app that adjusts the cron script (although i'm only guessing...)

Dan Kelley 's picture

These are PHP applications I have written myself.

As I said, I have suppressed their output, but it still creates an email to my root user each time they run. Currently it only includes the subject as the command in cron that ran, but I see no way to shut them off as of yet.

I've read some posts online regarding general Linux usage that say you can direct stout to dev/null, but I don't want to permanently do that for all scripts.

Jeremy Davis's picture

When you say that you have suppressed their output, I assume you mean you have suppressed the level of reporting of your PHP app? By my understanding that should do it, but obviously not...

Maybe there is a setting in the php.ini that can further suppress them? TBH I imagine that the config is fairly stock standard Debian (v13.x = Wheezy; v12.x = Squeeze) PHP/Apache/Cron config (I just had a quick look at the LAMP appliance source and couldn't see any tweaks that might create this behaviour).

I suggest that you have a google, although TBH I just did and didn't find anything that really jumped out at me as being a solution to your issue. Sorry not much help really...

Dan Kelley's picture

Thanks for looking into the source and offering some thoughts.  I too, didn't find much from Google... then I realized that I could just create a cron job to erase the mail file and schedule it to run. Thereby eliminating it getting too large regardless of my scripts output.

So I have a cron job that has as its command: 

> /var/mail/root

 

Jeremy Davis's picture

That'll do it... Still I'm not sure why it is doing that in the first place, not ideal behaviour IMO...

Add new comment