1)判断进程是否存在,如果不存在再执行启动命令,可以避免一个脚本同时启动多份

if [ $(ps -ef |grep  bastion_account.sh|grep -v grep|wc -l) -eq 0 ];then
    nohup sh bastion_account.sh &
fi

2)如何批量kill进程?

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

3)查看端口

netstat -lnpt 查看服务
ss -e 查看所有的连接数

4)查看服务器有没有来源某个ip的连接

netstat -anpl |grep '192.168.10.15'

5)分析 access log慢请求

cat access.log | awk ' $1>0.5 {print $1,$12}'

6)查看服务状态

service --status-all



原文地址:linux shell工具集合
标签:shell   

智能推荐

相关文章:

  • 2021-09-29
  • 2022-12-23
  • 2021-08-25
  • 2021-05-09
  • 2022-12-23
  • 2021-10-29
  • 2022-01-01
猜你喜欢
  • 2021-05-19
  • 2021-10-19
  • 2022-12-23
  • 2021-08-10
相关资源
相似解决方案