Question

[Solved] “(CRON) info (No MTA installed, discarding output)” error in the syslog

I have a fresh install of Ubuntu 12.04.1 LTS an a number of servers.

I have not added any cron jobs or edited my crontab on those servers, however, at around the same time for each machine, I get a 75% CPU spike and the following info in my syslog at the time of the spike:

CRON[8380]: (CRON) info (No MTA installed, discarding output)

I have mono-complete installed and am running a service stack webserver.

What is the best way for me to stop this from happening? I would like to be able to remove the CPU spike.

Enquirer: sungiant

||

Solution #1:

Linux uses mail for sending notifications to the user. Most Linux distributions have a mail service including an MTA (Mail Transfer Agent) installed. Ubuntu doesn’t though.

You can install a mail service, postfix for example, to solve this problem.

sudo apt-get install postfix

Or you can ignore it. I don’t think the inability of cron to send messages has anything to do with the CPU spike (that’s linked to the underlying job that cron is running). It might be safest to install an MTA and then read through the messages (mutt is a good system mail reader).

Respondent: martin

Solution #2:

This happens because your cron jobs are producing output and then the cron daemon tries to email that output to you (i.e. root). If you don’t need that output, the easiest way to solve this is to discard it at the crontab:

sudo crontab -e

and add >/dev/null 2>&1 to every job:

* * * * * yourCommand >/dev/null 2>&1
Respondent: rob

Solution #3:

In my case, the message was hinting at a permissions problem with the bash script, but I couldn’t see it until I installed an MTA.

As suggested I ran:

sudo aptitude install postfix

I chose “Local” during setup and after running the cron job again:

sudo tail -f /var/mail/<user>

In my case I replaced

<user>

with “root”.

I was then able to see the error output related to permissions.

Respondent: Martin Carstens

Solution #4:

As stated in an earlier answer,
this happens because your cron jobs are producing output,
and then the cron daemon tries to email that output to you. 
If you don’t want to (or can’t) install an MTA,
but you want to see the output,
you can redirect the output of the cron job to a log file. 
Edit your crontab file with

crontab -e

(use sudo if the issue is with root’s crontab)
and add >> /some/log/file 2>&1
after every command, like this:

0 3 * * * cmd  >> /some/log/file 2>&1

If there are multiple commands on a line,
separated by ;,? &&? or ||,
you should do the above for each command, like this:

0 3 * * * cmd1  >> /some/log/file 2>&1;  cmd2  >> /some/log/file 2>&1

or group them, like this:

0 3 * * * (cmd1;  cmd2)  >> /some/log/file 2>&1

If you want to ignore stdout and capture only stderr,
use > /dev/null 2>> /some/log/file instead. 
Put the log file wherever you want — your home directory,
/var/log, or even /tmp if you’re sure you won’t need to keep it.

Then look at the log file after the job runs.

Solution #5:

In crontab add this as first line:

MAILTO=""

This will prevent cron from trying to send an e-mail.

Respondent: 88weighed

Solution #6:

This is an old question but there is an additional answer that is useful in some circumstances.

Pipe the output of your cron command through logger so they end up in the syslog.

It’s slightly easier than installing postfix, and it puts this output into syslog alongside your other logs. This command will capture stdout AND stderr so you won’t see the No MTA installed message and you’ll see all your output in the syslog.

Example cron entry:

0 3 * * * (cmd1;  cmd2) 2>&1 | logger -t mycmd

You can view logs with your tag mycmd using:

grep 'mycmd' /var/log/syslog
Respondent: Michael Hunter

Solution #7:

If you don’t want to install an MTA (which I currently have no need for) you can pipe the results of the cron job to a log file.

sudo crontab -e

then with your cron job would look like this.

0 3 * * * /cmd/to/run >> /var/log/somelogfile.log

then you can just tail the log and see what happened

sudo tail -f -n 50 /var/log/somelogfile.log

This is what I have been doing on any server that I see that message in syslog

Solution #8:

One side effect of adding /dev/null 2>&1 to the cron job command, is that it will discard both STDERR and STDOUT (Standard Error as well as Output). This works fine if you don’t want any emails from cron. But if you want your errors to be emailed to you, use >/dev/null instead. Read this blog post for more explanation.

You’ll still need to install an MTA (mail transfer agent) to send the error emails though. Postfix is simple enough to install with: sudo apt-get install postfix

Respondent: paneer_tikka

Solution #9:

You can set MAILTO=”” variable at the start of your crontab file. This will also disable email alert. Edit/Open your cron jobs:

$ crontab -e

At the top of the file, enter:

MAILTO=""

https://www.cyberciti.biz/faq/disable-the-mail-alert-by-crontab-command/

Respondent: Damien C

Solution #10:

  1. At first, install postfix, that can resolve the problem

    sudo apt-get install postfix
    
  2. If Ubuntu, you can edit the crontab file

    sudo vim /etc/crontab
    
  3. Attention?edit the top file?not any code in the first line?and enter

    MAILTO=root // current system user
    
  4. When cron executes any task?you will get an email

    mail
    
Respondent: shahramlu

Solution #11:

I had this problem using the Kitematic Docker tools.
Go to the magento container and click on exe.

Then run

apt-get update

This is if you’re trying to get magento run on kitematic. The log will show this error on the virtual machine:

need update.

Sorry if this got you lost, but that’s how it works. You keep getting lost, but just read about it and the pieces will come together one day. Be patient.

Respondent: Ali Bayati

The answers/resolutions are collected from stackoverflow, are licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0 .

Most Popular

To Top
India and Pakistan’s steroid-soaked rhetoric over Kashmir will come back to haunt them both clenbuterol australia bossier man pleads guilty for leadership role in anabolic steriod distribution conspiracy