How to configure Crontab logging in Ubuntu

Source: Internet
Author: User
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.