Shell脚本关闭Nginx进程

[root@testapp ~]# ps -ef | grep nginx
root     25265 25216  0 09:22 pts/0    00:00:00 grep --color=auto nginx
root     32753 23683  0 Apr01 ?        00:00:00 nginx: master process ./nginx
nobody   32754 32753  0 Apr01 ?        00:00:00 nginx: worker process
[root@testapp ~]# ps -ef | grep nginx | grep -v grep
root     32753 23683  0 Apr01 ?        00:00:00 nginx: master process ./nginx
nobody   32754 32753  0 Apr01 ?        00:00:00 nginx: worker process
[root@testapp ~]# ps -ef | grep nginx | grep -v grep | awk '{print $2}'
32753
32754
[root@testapp ~]# ps -ef | grep nginx | grep -v grep | awk '{print $2}' | xargs kill -9

你可能感兴趣的:(linux,nginx,服务器)