Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I am facing an issue with Ubuntu server. I am running a PHP script using a cron job which executes every 5 minutes. This folder spool/mqueue is showing 112GB space. The scripts job is to fetch data from MySQL. If there is no data it will show an error. Now there is an error and cron is trying the send the mail to the users where user email is not defined and it is creating log file in mqueue folder.

How to customize cron so that it would not send mails and write logs?

share|improve this question
1  
What is the 'ubuntu space issue' if you only want cron to shut up? –  aquaherd Jan 25 '13 at 9:22

2 Answers 2

up vote 5 down vote accepted

You can set the MAILTO variable in your crontab.

Just type the following at the top of your crontab (crontab -e):

MAILTO=""

and cron will not send any mail for any of the jobs. If you have to disable mails for a specific task, use the following:

@hourly /path/to/script.sh >/dev/null 2>&1
share|improve this answer

Add this after your cronjob (append if you will): > /dev/null 2>&1

This will put everything your sript sends to standard input (and error) into the null device. And as such cron won't say a thing.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.