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

前端 未结 2 1586
执念已碎
执念已碎 2020-12-15 23:40

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

/home/ubuntu/nodes/app1/app.js
/home/ubuntu/nodes/app2/app.js
2条回答
  •  孤城傲影
    2020-12-16 00:13

    You can use an uid (see here):

    $ sudo forever --uid "app1" start app.js
    $ sudo forever --uid "app2" start app.js
    

    And to stop:

    $ sudo forever stop app1
    

    Update
    The --uid option is deprecated. Now you can use the --pidFile option. Example:

    forever start --pidFile /some/path/app1.pid app.js
    forever start --pidFile /some/path/app2.pid app.js
    

    And to stop:

    forever stop --pidFile /some/path/app1.pid
    

提交回复
热议问题