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
1 Answer
Reset to default 20Example 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.