首页 > 日志文件大小触发清理文件日志,并保持正常的日志输出;
头像
我是丰子小白
编辑于 2020-06-27 00:27
+ 关注

日志文件大小触发清理文件日志,并保持正常的日志输出;

# weblogic 日志文件大小触发清理文件日志,并保持正常的日志输出;
#!/bin/bash
# clean the nohup.out file of domain
# author by:guoqian
# date:2018-06-19

path="/home/weblogic/Oracle/Middleware/user_projects/domains/domain/bin"

if [ $# -eq 0  ];then
cd $path
file_size=`du -sm nohup.out| awk '{print $1}'`

if [ $file_size -ge 2000 ];then
/bin/cp /dev/null nohup.out
echo "$(date +%F' '%X) :The file size $file_size M , clean it over!" >> $path/clean_nohup.out.log
else
echo "$(date +%F' '%X) :The file size $file_size M , not clean it !" >> $path/clean_nohup.out.log
fi

else
echo "Don't take parameters !"

全部评论

(0) 回帖
加载中...
话题 回帖

推荐话题

相关热帖

近期热帖

近期精华帖

热门推荐