How to restart a PM2 process with process name instead of process id?
Asked Answered
F

1

10

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?

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.

Footstalk answered 10/9, 2017 at 6:3 Comment(0)
A
13

From the documentation:

pm2 start web.js --name "web-interface"
pm2 restart web-interface
Americanize answered 10/9, 2017 at 6:45 Comment(1)
Thank you, I was referring their Quick Start page pm2.keymetrics.io/docs/usage/quick-start/#cheat-sheet and this information is missing there.Footstalk

© 2022 - 2024 — McMap. All rights reserved.