Shell产出01|定时清日志脚本|Shell】的更多相关文章

在应用疯狂打日志的情况下,服务器很容易被塞满磁盘. 先要写一个shell脚本,脚本如下. #!/bin/bash #----------------使用规范---------------- #1.该文件固定存放在linux的 /usr/local/zjport_test/delFiles 目录下 #2.各责任人维护好要清理日志文件的目录,并以注释方式备注写明谁维护 #find:linux的查找命令,用户查找指定条件的文件: #/opt/soft/log/:想要进行清理的任意目录: #-mtime…
参考https://blog.csdn.net/qq_39291929/article/details/79054452 1.需求:我们在 /var/log下面有   EmcsYn.log   和  EmcsNw.log  日志,每天分割,现在我们只需要保存一周的,其余的每天15:20:00定时删除  找到一周之前的日志: find /var/log/ -mtime +7 -name "EmcsNw.2*" find /var/log/ -mtime +7 -name "Em…
自动处理脚本 保留7天的,带详细时间戳, #!/bin/sh #description split logs file1=/var/log/messages file2=/var/log/rabbitmq/rabbit@yunshui-test.log time1=$(date -d 'yesterday' "+%Y%m%d-%H%M%S") cp $file1 $file1-$time1 gzip $file1-$time1 cat /dev/null > $file1 cp…
在远程运行节点创建一个cleanlog.sh 脚本文件 vin clenalog.sh 插入以下内容 #!/bin/env bash start=$(date +%y-%m-%d-%H%M%m) File=/software/dubbo-monitor-data/cleanlog/clean_log_$start.txt FilePath=/software/dubbo-monitor-data/statistics echo $File if [ ! -n "$1" ]; then…
定时备份日志 设置执行权限 [root@VM_0_10_centos shellScript]# chmod a+x logBackup,sh 脚本内容 [root@VM_0_10_centos shellScript]# cat logBackup,sh #!/bin/bash#===========================================# BACKUP LOGS#===========================================# 设置显示的日期…
from RogerZhu modified by King sh logback.rb "/data/logs/" "/tmp/domain" "analysis esb" 相关文件下载地址 https://pan.baidu.com/s/1qY7ggW0  参见 固定脚本无参方式 目录结构如下 /data/script/logback目录下有文件(该目录用于存放需要执行的shell脚本,shell可以以任何后缀结尾,这里定义为.rb是因为ed…
shell按日期自动切割nginx日志脚本 参考:自学it网 http://www.zixue.it/. #nginx日志切割脚本 #author:ce #!/bin/bash #设置日志文件存放目录 logs_path="/usr/local/nginx/logs/" #设置pid文件 pid_path="/usr/local/nginx/nginx.pid" #重命名日志文件 mv ${logs_path}access.log ${logs_path}acces…
脚本地址 https://github.com/anliven/L-Shell/tree/master/Shell-Basics 示例脚本及注释 #!/bin/bash echo "hello shell!" # 打印字符串"hello shell!" echo "Date: " `date` # 显示命令执行结果 echo "\"It is a test!\"" # \ 转义字符 echo '\"…
示例脚本及注释 #!/bin/bash echo "hello shell!" # 打印字符串"hello shell!" echo "Date: " `date` # 显示命令执行结果 echo "\"It is a test!\"" # \ 转义字符 echo '\"It is a test!\"' # 在单引号中原样输出字符串,不进行转义或取变量 echo -e "Pas…
转自: Linux 服务器系统监控脚本 Shell - 今日头条(www.toutiao.com)http://www.toutiao.com/i6373134402163048961/ 本程序在CentOS 6 下运行成功 其它系统请自行修改参数 monitor_man.sh 主程序 check_http_log.sh Nginx的日志分析模块 check_server.sh 检查Nginx和MySQL的运行状态模块 system_monitor.sh 系统状态模块 一共4个脚本文件 放在一个…