如何杀死通过SSH启动的Node.js的NOHUP进程 [英] How to kill a NOHUP process for Node.js launched via SSH
问题描述
我启动 node.js
服务器有 3000 端口nohup用于后台运行,但现在我要停止 node.js
3000 的服务器,然后使用相同的端口重新启动。我怎样才能停止这个过程?
I start node.js
server has 3000 port by nohup for background running, but now i want to stop the node.js
server with 3000 and start again with the same port. How can I stop the process?
我可以使用这个命令来杀死进程;
i can use this command for get the process to kill;
ps -a","ps -ef |grep nohup
但是它返回;
-bash: kill: (11929) - No such process
谢谢
推荐答案
最后我得到了一个解决方案杀死在nohup进程下运行的节点服务器
Finally i got an solution for kill the node server which is run under nohup process
借助
启动服务器@ background:< a href =https://stackoverflow.com/a/4018223/2616818> https://stackoverflow.com/a/4018223/2616818
start server @ background: https://stackoverflow.com/a/4018223/2616818
pid: https://stackoverflow.com/a/14152730
杀死: https://stackoverflow.com/a/8007409/2616818
1.通过使用获取节点进程ID
1.Get the node process id by use
ps -ef | grep "node"
//9500 pts/0 00:00:00 .node.bin
2.杀死进程
kill 9500
//you can use the PID to kill if not use kill -9 pid
供高级使用永远
这篇关于如何杀死通过SSH启动的Node.js的NOHUP进程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!