user824624 user824624 - 1 year ago 76
Node.js Question

node.js processes with the same name in forever are closed when trying to close only one

I am deploying two node.js apps on the aws, the two apps are in the paths shown as



to run the node.js apps in the background, I used forever to start two apps, so like

$ sudo forever start /home/ubuntu/nodes/app1/app.js
$ sudo forever start /home/ubuntu/nodes/app2/app.js

so forever works well by running the two node.js apps in the background process.
However, when I tried to stop one process with forever command like this.

$ sudo forever stop /home/ubuntu/nodes/app1/app.js

unexpectedly, both node.js process are closed with info like this

info: Forever stopped process:
data: uid command script forever pid logfile uptime
[0] r2pZ /usr/bin/nodejs app.js 24852 24854 /root/.forever/r2pZ.log 0:0:1:14.775
[1] 9f2h /usr/bin/nodejs app.js 24870 24872 /root/.forever/9f2h.log 0:0:0:58.733

I assume it is because two node.js process has the same name - app.js, how to avoid this by close only one process

Answer Source

You can kill only one process using the index of the process shown in the forever list command. For example, if you type forever stop 1, only the process with the index 1 will be killed

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download