Crontab Open Log Mode

Source: Internet
Author: User
Tags rsyslog

Crontab can run programs regularly, but sometimes there are problems with the program, and to monitor the program we can view the log of crontab, but unfortunately Linux (Ubuntu) turns off the log of crontab by default, so it's OK to turn on log. strong> Modify Rsyslog

<code class= "Language-shell hljs Haskell has-numbering" style=; padding:0px; Color:inherit; Box-sizing:border-box; font-family: ' Source Code Pro ', monospace;font-size:undefined; White-space:pre; border-radius:0px; Word-wrap:normal; background:transparent; " ><span class= "Hljs-title" style= "Box-sizing:border-box;" >sudo</span> vim/etc/rsyslog.d/<span class= "Hljs-number" style= "Color:rgb (0, 102, 102); Box-sizing:border-box; " >50</span>-<span class= "Hljs-default" style= "Box-sizing:border-box;" ><span class= "Hljs-keyword" style= "Color:rgb" (0, 0, 136); Box-sizing:border-box; " >default</span>.conf</span></code><ul class= "pre-numbering" style= "Box-sizing:border-box ; Position:absolute; width:50px; top:0px; left:0px; margin:0px; padding:6px 0px 40px; border-right-width:1px; Border-right-style:solid; Border-right-color:rgb (221, 221, 221); List-style:none; Text-align:right; Background-color:rgb (238,238, 238); " ><li style= "Box-sizing:border-box; padding:0px 5px; " >1</li></ul>

Vim in
cron.*/var/log/cron.log #将cron前面的注释符去掉 Restart rsyslog

<code class= "Language-shell hljs bash has-numbering" style= "display:block; padding:0px; Color:inherit; Box-sizing:border-box; font-family: ' Source Code Pro ', monospace;font-size:undefined; White-space:pre; border-radius:0px; Word-wrap:normal; background:transparent; " ><span class= "hljs-built_in" style= "Color:rgb" (102, 0, 102); Box-sizing:border-box; " >sudo</span> service Rsyslog restart</code><ul class= "pre-numbering" style= "Box-sizing:border-box" ; Position:absolute; width:50px; top:0px; left:0px; margin:0px; padding:6px 0px 40px; border-right-width:1px; Border-right-style:solid; Border-right-color:rgb (221, 221, 221); List-style:none; Text-align:right; Background-color:rgb (238, 238, 238); ><li style= "Box-sizing:border-box; padding:0px 5px; " >1</li></ul>
View crontab Log
<code class= "Language-shell hljs lasso has-numbering" style=; padding:0px; Color:inherit; Box-sizing:border-box; font-family: ' Source Code Pro ', monospace;font-size:undefined; White-space:pre; border-radius:0px; Word-wrap:normal; background:transparent; " >less/<span class= "hljs-built_in" style= "Color:rgb" (102, 0, 102); Box-sizing:border-box; " >var</span>/<span class= "Hljs-keyword" style= "Color:rgb" (0, 0, 136); Box-sizing:border-box; " >log</span>/cron<span class= "hljs-built_in" style= "Color:rgb" (102, 0, 102); Box-sizing:border-box; " >.</span><span class= "Hljs-keyword" style= "Color:rgb" (0, 0, 136); Box-sizing:border-box; " >log</span> </code> 

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.