在Ubuntu上查找Node JS实例 [英] Find Node JS instance on Ubuntu

查看:125
本文介绍了在Ubuntu上查找Node JS实例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我查找ctrl c, process.on('SIGNIT')之后,我写了一个脚本而没有放入 process.exit(0) ,gracefulShutdown)

I wrote a script without putting process.exit(0) after I looked out for the ctrl c, process.on('SIGNIT', gracefulShutdown)

我想知道这个过程是否仍在我的机器上运行,我用过:

I want to know if the process is still running on my machine, I used:

ps -aux | grep节点

它提出了一些东西,但我不确定它是什么。

It came up with something but i'm not sure what it is.

我想做的就是找到一个快速简便的方法来找到并杀死它。

All I want to do is find a quick easy way of finding the process and kill it.

谢谢

推荐答案

ps -aux |的输出示例grep节点

foo      22210  0.0  0.5 779600 46088 pts/2    Sl   Jan22   2:29 node ./server.js localhost:9999
foo      22794  0.0  0.0 692468   112 pts/4    Sl   Jan31   0:00 node ./static.js

这些显示我已启动的两台服务器。进程ID在第二列,所以如果我想结束运行 server.js 的服务器,那么:

These show two servers I've started. The process id is in the 2nd column so if I want to end the server that is running server.js, then:

kill 22210

如果不起作用:

kill -9 22210

一般来说,我更喜欢从没有信号选项的kill开始,它发送 TERM 信号。如果这不起作用,则 -9 ,发送 KILL 。在一般情况下, TERM 将使进程有机会彻底终止。

Generally speaking, I prefer to start with the kill without a signal option, which sends a TERM signal. If that does not work, then -9, which sends KILL. In the general case, TERM will give a chance to the process to terminate cleanly.

这篇关于在Ubuntu上查找Node JS实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆