This article describes how to configure Crontab logging in Ubuntu and how to solve the NOMTAINSTALLED and DISCARDINGOUTPUT problems in the logs. For more information, see the following label: Ubuntu
After crontab is installed in ubuntu, crontab logs are disabled by default. how to enable crontab logs:
Modify the rsyslog file and delete # before # cron. * in the/etc/rsyslog. d/50-default.conf file;
Restart rsyslog service rsyslog restart;
Restart the cron service cron restart;
Copy codeThe code is as follows:
More/var/log/cron. log;
You can view the log file at run time, if it appears in the log file:
Copy codeThe code is as follows: No MTA installed, discarding output
That is to say, the crontab script will not directly output error information, but will be sent to your mailbox in the form of an email. at this time, the mail server is required, if you have not installed the email server, it will report this error. If it is a test, you can use the following method to solve the problem:
Add the following to each scheduled script:
Copy codeThe code is as follows:>/dev/null 2> & 1
The problem of No MTA installed and discarding output can be solved.