Linux检查网站相关命令

杀掉所有队列进程

ps -ef | grep queue | grep -v grep | awk '{print $2}' | xargs kill -9

日志ip统计awk写法

cat access_log.20200515 | awk '{a[$1]++} END {for(i in a){print a[i]" "i}}' | sort -nr | head -n 10

日志url统计cut&sort&uniq写法

cat access_log.20200515 | cut -d '/' -f 4 | sort | uniq -c | sort -nr | head -n 10

查看http连接数

ps -ef | grep httpd | wc -l

查看各状态连接ip数

netstat -ntu | grep ESTABLISHED | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -nr | head -n 10

查看tcp各状态连接数

netstat -n | awk '/^tcp/ {++S[$NF]} END {for (a in S) print a, S[a]}'

查看tcp最大连接数

cat /etc/sysctl.conf | grep tcp_max_tw_buckets

查看端口使用情况

ss -lntpd | column -t | grep :80
lsof -i :80

apache监控shell

#!/bin/sh
http=`ps aux | grep http | wc -l`
time=$(date "+%Y-%m-%d %H:%M:%S")
if (($http > 360));then
echo $time
echo "http is $http"
/data/server/httpd/bin/apachectl restart
echo "apache restart"
fi

vbox安装增强功能

yum update kernel -y
yum install kernel-headers kernel-devel gcc make -y
/sbin/rcvboxadd setup

Linux Deploy在安卓手机安装LINUX系统教程


版权声明:本文为zh214w原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。