Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the method of storing Linux crontab logs?

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly explains the "Linux crontab log storage method is what", the article explains the content is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in-depth, together to study and learn "what is the Linux crontab log storage method"!

By default, logs executed in crontab are written under / var/log, such as:

# ls / var/log/cron*/var/log/cron / var/log/cron.1 / var/log/cron.2 / var/log/cron.3 / var/log/cron.4

If there is a problem with the log, you can refer to the following practice:

Add logs for crontab

Crontab's log is relatively simple, and when crond fails to perform a task, it will send an email to the user. It happened that a task did not execute properly on one of our servers, and crond email failed. By looking at mail's log, I can see that it is caused by a lack of disk space.

In addition, my colleague helped me to add my own log for the tasks in crontab, so that it was easier to see the reason after making an error.

0 6 * $HOME/for_crontab/createTomorrowTables > > $HOME/for_crontab/mylog.log 2 > & 1

Output both error output and standard output to mylog.log.

Note: do not write as

0 6 * $HOME/for_crontab/createTomorrowTables 2 > & 1 > > $HOME/for_crontab/mylog.log

Otherwise, it will be output to standard output.

Thank you for your reading, the above is the content of "what is the Linux crontab log storage method". After the study of this article, I believe you have a deeper understanding of what the Linux crontab log storage method is, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report