Linux writing shell script processing catalina.out long time large amount of log footprint system space problem __linux

Source: Internet
Author: User
Tags touch command

Today see the system space is occupied, and then look at large files, found that Catalina.out has been >60g, there are many solutions online, but still want to learn to write a shell script to deal with, in this record to write content, as well as the problems encountered and processing methods.

Directly on the content:

First: VI, Touch command to create auto-clear-currday-catalina_out-content.sh files, do not forget to give executable permissions: chmod +x Auto-clear-currday-catalina_ out-content.sh;

The second step: SH content is as follows:

##==========start==============##

#!/bin/sh

#auto-clear-currday-catalina_out-content

Cat/dev/null >/usr/local//tomcat7.0/logs/catalina.out

##==========end===============## relatively simple to clear the code;

Part III: I am using Linux crontab Timer task execution shell script, input crontab-e write timing content, as follows:

* * */home/auto-clear-currday-catalina_out-content.sh

Save write;



The problems encountered:

After the third write exit prompt: Errors in crontab file can ' t install. Here is your shell scripting code is wrong, but don't expect to be prompted for more detailed errors, because the need for branch ...

Before modification:

##==========start==============##

#!/bin/sh

#auto-clear-currday-catalina_out-content

Cat/dev/null >/usr/local//tomcat7.0/logs/catalina.out

##==========end===============##

After modification:

##==========start==============##

#!/bin/sh

#auto-clear-currday-catalina_out-content

Cat/dev/null

>/usr/local//tomcat7.0/logs/catalina.out

##==========end===============##








Related Article

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.