Ubuntu: "(CRON) info (No MTA installed, discarding output)" error in the syslog
Описание
Ubuntu: "(CRON) info (No MTA installed, discarding output)" error in the syslog
Question: 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.
Solutions Sample (Please watch the whole video to see all solutions, in order of how many people found them helpful):
== This solution helped 10 people ==
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. http://www.mydigitallife.info/
cron-differences-between-devnull-21-and-devnull/.
You'll still need to install an MTA (message transfer agent) to send the error
emails though. Postfix is simple enough to install with: sudo apt-get install
postfix
== This solution helped 10 people ==
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
== This solution helped 154 people ==
Linux uses mail for sending notifications to the user. Most Linux distributions
have a mail service (including an MTA) 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).
== This solution helped 19 people ==
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
With thanks & praise to God! With thanks to the many people who have made this project possible! | Content (except music & images) licensed under cc by-sa 3.0 | Music: https://www.bensound.com/royalty-free-music | Images: https://stocksnap.io/license & others | With thanks to user zx485 (https://askubuntu.com/users/51957), user Thomas (https://askubuntu.com/users/490838), user sungiant (https://askubuntu.com/users/111028), user shahramlu (https://askubuntu.com/users/866875), user rob (https://askubuntu.com/users/152362), user Ravexina (https://askubuntu.com/users/264781), user paneer_tikka (https://askubuntu.com/users/230173), user muru (https://askubuntu.com/users/158442), user Michael Hunter (https://askubuntu.com/users/750594), user martin (https://askubuntu.com/users/117977), user Martin Carstens (https://askubuntu.com/users/428377), user Kaz Wolfe (https://askubuntu.com/users/208574), user G-Man (https://askubuntu.com/users/325633), user Dr.jacky (https://askubuntu.com/users/423103), user Damien Cuvillier (https://askubuntu.com/users/796895), user Braiam (https://askubuntu.com/users/169736), user Andrew MacNaughton (https://askubuntu.com/users/422391), user Ali Bayati (https://askubuntu.com/users/872847), user abu_bua (https://askubuntu.com/users/790920), user 88weighed (https://askubuntu.com/users/150328), and the Stack Exchange Network (http://askubuntu.com/questions/222512). Trademarks are property of their respective owners. Disclaimer: All information is provided "AS IS" without warranty of any kind. You are responsible for your own actions. Please contact me if anything should be amiss at Roel D.OT VandePaar A.T gmail.com.
Рекомендуемые видео



















