Elgirhath
Elgirhath

Reputation: 449

Run the same process with different arguments using PM2

I want to run npm start /app1 and npm start /app2 so both of these apps run as daemons. I am logged onto an external virtual machine using SSH.

At first I tried using PM2 like this:

$ pm2 start npm -- start --prefix /app1

and it works for a single application, but when I do

$ pm2 start npm -- start --prefix /app1
$ pm2 start npm -- start --prefix /app2

The first app is killed (the second works). Seems that npm is a single process which I can't share between these 2 applications.

How can I run those 2 npm processes concurrently?

Upvotes: 2

Views: 1804

Answers (1)

MikZuit
MikZuit

Reputation: 734

As stated in comments you should run:

 pm2 start npm --name 'Your APP Name' -- start --prefix /app1

respect the order of options.

Also in order to see your active intances use "npm ls" so might not have an accidentally created an "npm" app. if so, use "pm2 del npm" to delete it.

Upvotes: 2

Related Questions