问题描述
我已经在osx上安装并正在运行一个node.js服务器.我已经释放了一个聊天模块,并且正在愉快地运行它.我更改了一些内容,需要重新启动服务器才能看到效果.
I've installed and is running a node.js server on osx. I've dled a chat module and is happily running it. I've altered some pieces and need to restart the server to see the effects.
我只知道如何通过关闭终端窗口,然后重新对其进行操作,然后再次运行节点chatdemo.js来重新启动.
I only know how to restart by closing the terminal window and then reopneing it and then running node chatdemo.js again.
是否可以在不关闭终端的情况下重新启动?
Any way to restart without closing terminal?
谢谢.
推荐答案
如果它正在运行(不是守护程序),则只需使用Ctrl-C
.
If it's just running (not a daemon) then just use Ctrl-C
.
如果它是守护进程,则可以尝试:
If it's daemonized then you could try:
$ ps aux | grep node
you PID 1.5 0.2 44172 8260 pts/2 S 15:25 0:00 node app.js
$ kill -2 PID
PID
替换为ps
输出中的数字的地方.
Where PID
is replaced by the number in the output of ps
.
这篇关于如何重启node.js服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!