Shell脚本中执行关闭进程的命令

[root@centos00 ~]# ps -ef | grep nginx
root 6682 1 0 18:30 ? 00:00:00 nginx: master process sbin/nginx
nobody 6801 6682 0 18:46 ? 00:00:00 nginx: worker process
root 7104 4224 0 20:17 pts/4 00:00:00 grep nginx
[root@centos00 ~]# ps -ef | grep nginx | grep -v grep
root 6682 1 0 18:30 ? 00:00:00 nginx: master process sbin/nginx
nobody 6801 6682 0 18:46 ? 00:00:00 nginx: worker process
[root@centos00 ~]# ps -ef | grep nginx | grep -v grep | awk '{print $2}'
6682
6801
[root@centos00 ~]# ps -ef | grep nginx | grep -v grep | awk '{print $2}' | xargs kill -9

猜你喜欢

转载自www.cnblogs.com/ji-hf/p/13381538.html