How to kill a NOHUP process for Node.js launched v

2019-03-16 20:38发布

问题:

I start node.js server has 3000 port by nohup for background running, but now i want to stop the node.js server with 3000 and start again with the same port. How can I stop the process?

i can use this command for get the process to kill;

ps -a","ps -ef |grep nohup

but it return;

-bash: kill: (11929) - No such process

thanks

回答1:

Finally i got an solution for kill the node server which is run under nohup process

by the help of

start server @ background: https://stackoverflow.com/a/4018223/2616818

pid: https://stackoverflow.com/a/14152730

Kill: https://stackoverflow.com/a/8007409/2616818

1.Get the node process id by use

ps -ef | grep "node"
//9500 pts/0  00:00:00 .node.bin

2.Kill the process by

kill 9500
//you can use the PID to kill if not use kill -9 pid

for advanced use forever