AndesStay 2020-01-03
批量根据服务名称查询进程id然后批量杀
sudo ps -ef|grep java | awk ‘{print $2}‘|sudo xargs kill -9
sudo ps -ef|grep python |awk ‘{print $2}‘|sudo xargs kill -9
sudo ps -ef|grep process |awk ‘{print $2}‘|sudo xargs kill -9
sudo ps -ef|grep redis |awk ‘{print $2}‘|sudo xargs kill -9
sudo ps -ef|grep storage-serv |awk ‘{print $2}‘|sudo xargs kill -9
sudo ps -ef|grep mysqld |awk ‘{print $2}‘|sudo xargs kill -9
sudo ps -ef|grep kube |awk ‘{print $2}‘|sudo xargs kill -9
根据port 查询服务进程/id:
[ sbin]# lsof -i:80
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
nginx 8246 root 6u IPv4 64233 0t0 TCP *:http (LISTEN)
nginx 8247 nobody 6u IPv4 64233 0t0 TCP *:http (LISTEN)
也可以: