Issue with Cronjob “(cron) info (no mta installed, discarding output)”

DigitalOcean Referral Badge
Start your VPS now with FREE $100 credit.

A cronjob is a scheduled task in Unix and Unix-like operating system environments, including Linux, Mac OS X, and FreeBSD.

The operating system can execute various scheduled tasks, from opening a file to shutting down a system completely. Cronjobs can also be configured to run programs that need root access.

However, like all software, cronjobs can also fail, and the failure reasons are often simple enough to troubleshoot. For example, on a fresh install of Linux, a cronjob might silently fail with the error “(cron) info (no mta installed, discarding output)”.

What Caused it?

The error is caused by the lack of MTA (mail transport agent) in the Linux system. By default, a cronjob will run and the result of the cronjob will be sent to a specified email address. Without the MTA installed, though, the email will not be sent.

How to Solve It

To solve the error, you can install a mail transport agent such as postfix by issuing the following command:

apt-get install postfix

This will fix the cronjobs failing as well as allowing the cronjob status email to be sent to the specified email address. However, if you prefer to have less software installed on the computer, or simply do not wish to get emails about the cronjob, you can add the following line to the crontab file. Issue this following command:

crontab –e

And add the following line to the first line of the crontab file:

MAILTO=""

Save the crontab file to apply the changes. Note that the cron daemon or the system does not need to be restarted to apply changes to the crontab file.

READ:  Solving Docker Error Processing tar File

Another option is to ignore the error if the cronjob itself runs okay without any other errors. The success and failure of cronjobs can be monitored with other cronjob monitoring tools, such as Cronitor.

Leave a Comment