node.js 如何杀死 pm2 --no-daemon 进程
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/45204172/
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 the pm2 --no-daemon process
提问by Junya Kono
I'm using pm2 as the process manager of Node.js.
我使用 pm2 作为 Node.js 的进程管理器。
In many cases, I think I will run it as a daemon process, but if you use it locally as debugging, I think that there are times when you use the --no-daemonoption.
在很多情况下,我想我会把它作为一个守护进程来运行,但是如果你在本地使用它作为调试,我认为你有时会使用该--no-daemon选项。
How do I end the process when moving pm2 with this --no-daemonoption?
使用此--no-daemon选项移动 pm2 时如何结束该过程?
回答by marekful
You can try:
你可以试试:
pm2 kill
pm2 kill
or find the running PM2 process with:
或使用以下命令查找正在运行的 PM2 进程:
ps aux | grep PM2
ps aux | grep PM2
then kill with:
然后杀死:
kill -9 [pid]
kill -9 [pid]
回答by Sergey Yarotskiy
Other solution will be to run pm2 delete allor pm2 stop all. Which will not kill pm2 process itself, but will cleanup internal pm2's process list.
其他解决方案是运行pm2 delete all或pm2 stop all。这不会杀死 pm2 进程本身,但会清除内部 pm2 的进程列表。
回答by Pierre Ghislain
The right answer is pm2 kill
正确答案是pm2 kill
$pm2 kill
[PM2] [v] Modules Stopped
[PM2] Applying action deleteProcessId on app [all](ids: 0)
[PM2] hello ?
[PM2] [v] All Applications Stopped
[PM2] [v] PM2 Daemon Stopped
$ pm2 kill
[PM2] [v] 模块停止
[PM2] 在应用程序上应用操作 deleteProcessId [all](ids: 0)
[PM2] 你好?
[PM2] [v] 所有应用程序停止
[PM2] [v] PM2 守护进程停止
回答by Caption Newt
You can view all processes which are registered with pm2 using
您可以查看使用 pm2 注册的所有进程
pm2 list
pm2 list
Assume the process you want to stop is named as processA using the below command will stop the processA:
假设您要停止的进程被命名为 processA,使用以下命令将停止 processA:
pm2 stop processA
pm2 stop processA
In case you want to delete the process than use the below command:
如果您想删除该进程,请使用以下命令:
pm2 delete processA
pm2 delete processA
In case you don't want to kill a particular process but pm2 itself using the command below:
如果您不想使用以下命令杀死特定进程而是 pm2 本身:
pm2 kill
pm2 kill
回答by Chase
If it's running in the foreground you should be able to kill it with ctl + c, same as you would kill node server.js.
如果它在前台运行,你应该可以用 杀死它ctl + c,就像你杀死它一样node server.js。

