如何用进程名而不是进程id重新启动PM2进程?

时间:2022-03-16 20:14:35

When we are running multiple node services in a single machine, its becoming hard to restart one service with id as id is a sequence number allocated in order by PM2. So instead using the id is it possible to restart the process using process name?

当我们在一台机器中运行多个节点服务时,很难使用id重新启动一个服务,因为id是由PM2按顺序分配的序列号。因此,是否可以使用id使用进程名重新启动进程?

I start my services with the service name using following command:

我使用以下命令启动服务名称:

pm2 start index.js --name my-service-name

I want to restart them using the name 'my-service-name' so that I can automate it using a script.

我想使用名称“my-service-name”重新启动它们,以便使用脚本实现自动化。

1 个解决方案

#1


2  

From the documentation:

从文档:

pm2 start web.js --name "web-interface"
pm2 restart web-interface

#1


2  

From the documentation:

从文档:

pm2 start web.js --name "web-interface"
pm2 restart web-interface