Tomcat Catalina.out Cutting scripts

Source: Internet
Author: User

Shell script Catalina.out Cutting script ... 23.30 cuts per day. Delete logs up to seven days ago

Here are 3 tomcat instances,,,

The script is very simple: (1) Copy log file (2) empty log file * Only empty if delete Tomcat does not restart will not generate new log files * (3) Delete backup files up to seven days ago

The name of the backup file is Catalina.out_ time

#!/bin/bash# Cut # Backup time bak_time= ' date -d today + '%Y%m%d ' ' # Log directory bak_path=/data/tomcat/store/logs/###################################### #log #im_6.0bak_path_im=/data/ tomcat/im_6.0/logs/##################################### #log #backbak_path_aisk=/data/tomcat/aisk.back/logs/# LOG file log=catalina.out# The name of the backup log_bak= $LOG. Time variable d7= ' date -d ' 7 day ago '  +%y%m%d ' in _time# seven days ago $BAK # # # #切割im_6.0 of logs         /bin/cp  $BAK _path_im$log  $BAK _path_im $LOG _bak        echo  ""  >  $BAK _path_im$log# deleted seven days ago Log- -rm -fr  parameter not deleted file will not have error message/bin/rm -rf  $BAK _path_im$log. $D 7### #切割back/log          /bin/cp  $BAK _path_aisk$log  $BAK _path_aisk$log_bak         echo  ""  >  $BAK _path_aisk$log/bin/rm -rf  $BAK _path_ Aisk$log. $D 7 

Please give me more advice ~ ~ ~

This article is from the "share is a virtue" blog, please be sure to keep this source http://passers.blog.51cto.com/9686614/1586656

Tomcat Catalina.out Cutting scripts

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.