当前位置:网站首页>Some little records~
Some little records~
2022-04-23 14:22:00 【Small ash pier】
Some little records
1 The log content is cleaned regularly
# mkdir Test
# cd Test/
# touch a{1..10}.log
# ls
a10.log a1.log a2.log a3.log a4.log a5.log a6.log a7.log a8.log a9.log
# for i in `ls ~/Test`;do echo "${i}">$i;done
The above is the environment , In this similar environment , Cooperate with the task plan *.log journal
# find /root/Test/ -name *.log |awk '{print "echo >" $1}' |bash
2 Log backup and cleanup 7 Day's diary
#!/bin/bash
# This script is used to schedule task execution
# crontab -l
# 59 23 * * * /bin/bash /kingdee/nginxLog/logrotate_nginx_log.sh > /dev/null 2>&1
nginx_log_path="/kingdee/nginxLog"
function logrotate_nginx_log(){
if [ -d "${nginx_log_path}" ]; then
cd ${nginx_log_path}
cp error.log cutlog/error-$(date -d "today" +"%Y%m%d").log
echo > error.log
cp access.log cutlog/access-$(date -d "today" +"%Y%m%d").log
echo > access.log
find ${nginx_log_path}/cutlog -mtime +7 -type f -name "*.log" -exec rm -f {
} \;
fi
}
logrotate_nginx_log
3 Display disk exceeds 80% Usage rate and corresponding directory
# df -h|awk '{if(NR != 1){split($5,a,"%");if(a[1]>0){print $5,$6}}}'|sort -t '%' -k1 -nr|egrep '[8-9][0-9]%|100%'
4 top in cpu Usage rate (100-id)
# top -b -n1 |fgrep 'Cpu(s):' |awk -F'id,' '{split($1,k,",");v=k[length(k)];sub(/%/,"",v);printf "%s\n",100-v;}'
版权声明
本文为[Small ash pier]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204231409158352.html
边栏推荐
- source insight via samba
- API Gateway/API 网关(二) - Kong的使用 - 负载均衡Loadbalance
- 線程組ThreadGroup使用介紹+自定義線程工廠類實現ThreadFactory接口
- krpano全景之vtour文件夹和tour
- DP - [noip2000] grid access
- 线程间控制之CountDownLatch和CyclicBarrier使用介绍
- 时间复杂度计算举例
- 统信UOS PHP7.2.3升级至PHP7.2.24
- Five ways of using synchronized to remove clouds and fog are introduced
- 百度笔试2022.4.12+编程题目:简单整数问题
猜你喜欢
单相交交变频器的Matlab Simulink建模设计,附Matlab仿真、PPT和论文等资料
关于UDP接收icmp端口不可达(port unreachable)
XX project structure notes
Tongxin UOS php7 2.3 upgrade to php7.0 two point two four
asp.net使用MailMessage发送邮件的方法
xx项目架构随记
C语言知识点精细详解——初识C语言【1】
1分钟看懂执行流程,永久掌握for循环(附for循环案例)
电子秤称重系统设计,HX711压力传感器,51单片机(Proteus仿真、C程序、原理图、论文等全套资料)
使用Executors类快速创建线程池
随机推荐
OpenSSH的升级、版本号的修改
Quickly understand the three ways of thread implementation
Tongxin UOS php7 2.3 upgrade to php7.0 two point two four
电子秤称重系统设计,HX711压力传感器,51单片机(Proteus仿真、C程序、原理图、论文等全套资料)
LLVM - 生成加法
LLVM - 生成 if-else 以及 PH
API Gateway/API 网关(四) - Kong的使用 - 集成Jwt和熔断插件
在电视屏幕上进行debug调试
拨开云雾synchronized使用五种方式介绍
js 进度条,显示加载进度
asp.net使用MailMessage发送邮件的方法
grep无法重定向到文件的问题
Thread group ThreadGroup uses introduction + custom thread factory class to implement threadfactory interface
Use cases of the arrays class
c语言在结构体传参时参数压栈问题
Redis源码分析之HSET流程与ziplist
LLVM - 生成局部变量
C语言知识点精细详解——数据类型和变量【1】——进位计数制
关于UDP接收icmp端口不可达(port unreachable)
API gateway / API gateway (IV) - use of Kong - Integrated JWT and fuse plug-in