最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Find Node JS instance on Ubuntu - Stack Overflow

programmeradmin8浏览0评论

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 node

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.

Thanks

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 node

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.

Thanks

Share Improve this question asked Feb 5, 2014 at 11:21 Callum LiningtonCallum Linington 14.4k14 gold badges79 silver badges156 bronze badges 1
  • sudo pkill node. But it might be a little unsafe if you have another process with this name so I don't really remend it. – Denys Séguret Commented Feb 5, 2014 at 11:22
Add a ment  | 

1 Answer 1

Reset to default 20

Example of output from ps -aux | grep node:

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

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

If that does not work:

kill -9 22210

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.

发布评论

评论列表(0)

  1. 暂无评论