bash 如何终止通过 SSH 启动的 Node.js 的 NOHUP 进程
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/25152943/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to kill a NOHUP process for Node.js launched via SSH
提问by Saravanan Rajaraman
I start node.js
server has 3000port by nohup for background running, but now i want to stop the node.js
server with 3000and start again with the same port. How can I stop the process?
我通过 nohup启动node.js
服务器有3000 个端口用于后台运行,但现在我想node.js
用3000停止服务器并使用相同的端口重新启动。我怎样才能停止这个过程?
i can use this command for get the process to kill;
我可以使用这个命令来杀死进程;
ps -a","ps -ef |grep nohup
but it return;
但它回来了;
-bash: kill: (11929) - No such process
thanks
谢谢
回答by Saravanan Rajaraman
Finally i got an solution for kill the node server which is run under nohup process
最后我得到了杀死在 nohup 进程下运行的节点服务器的解决方案
by the help of
借助
start server @ background: https://stackoverflow.com/a/4018223/2616818
启动服务器@后台:https: //stackoverflow.com/a/4018223/2616818
pid: https://stackoverflow.com/a/14152730
pid:https: //stackoverflow.com/a/14152730
Kill: https://stackoverflow.com/a/8007409/2616818
杀死:https: //stackoverflow.com/a/8007409/2616818
1.Get the node process id by use
1.通过use获取节点进程id
ps -ef | grep "node"
//9500 pts/0 00:00:00 .node.bin
2.Kill the process by
2.杀死进程
kill 9500
//you can use the PID to kill if not use kill -9 pid
for advanced use forever
永远高级使用