简体   繁体   中英

Start multiple processes via npm scripts using PM2

I want to start multiple processes by pm2 .

I found how to start one process for npm run start :

pm2 start npm -- start

But when I've tried make something like pm2 start npm -- event for npm run event it doesn't start a new process but restarts the first one.

How can I start multiple process by npm and pm2 ?

Use the --name flag to give each processes a unique name for PM2 to identify them by.

For example:

pm2 start --name=start npm -- start
pm2 start --name=event npm -- run event

Further operations should use the name you have given each process. For example to stop them:

pm2 stop start
pm2 stop event

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM