Linux removes all generated log files from Tomcat

Source: Internet
Author: User

#!/bin/bash

#!/bin/bash

#exact All log files

#计算log文件个数
log_number= ' ls *.log |grep log-c '

#当log文件数大于0时遍历删除文件中的文件夹
If [$log _number-gt 0];then
list_log_files=$ (LS *.log)
#Traverse to delete files
For log_file in $list _log_files
Do
#delete All log files
RM-RF $log _file
log_file_number= ' ls |grep $log _file-c '
If [$log _file_number-eq 0];then
echo "Delete $log _file successfully"
Else
echo "Delete $log _file failed"
Fi
Done
Fi
log_number= ' ls *log.* |grep log-c '
Echo $log _number
If [$log _number-gt 0];then
list_log_text=$ (LS *log.*)
For Log_text in $list _log_text
Do
RM-RF $log _text
log_file_number= ' ls |grep $log _text-c '
If [$log _file_number-eq 0];then
echo "Delete $log _text successfully"
Else
echo "Delete $log _text failed"
Fi
Done
Fi

Linux removes all generated log files from Tomcat

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.