0

I'm kinda new to pm2 and I'm in a situation where I have two ecosystem that are identical, here's how that happened :

I have one ecosystem that was working fine, but a few days ago when I tried to use pm2 list or any commands using process pid I would have an error telling me pm2 has nothing running (but my application were still online !)

After looking it up online I found a solution that said to use "pm2 update" once I did it created what a think is a copy of the previous pm2 ecosystem and now I have errors that tell me my application ports are already in use

I checked the pm2 pid folder and here's what I found : pm2 pids folder

Every apps have two pids and the number match the pids they had on the first ecosystem and the new copy, those are online websites for my clients so I need to be very careful here with what I do and I'm completly lost, what I would need is to terminate one of the ecosystem without messing with the other, preferably deleting the copy and return to the original but I can't find any solution that might help me online.

Xanthous
  • 442
  • 3
  • 12

1 Answers1

0

In order to manage PM2 processes you should use some PM2 commands, like:

pm2 list 

This command will list all PM2 process. The first column give you an identification number that you can use in other commands:

pm2 stop xx

Where xx is the process identificatoin number, will permit you to stop a process, but not remove it. So if you need you cant start it again with:

pm2 start xx

I you just want to restart a proess, use:

pm2 restart xx

If you want to definitively remove the process:

pm2 delete xx
Alaindeseine
  • 3,260
  • 1
  • 11
  • 21
  • The problem is not with the processes, I have multiple instances of PM2 running, and when I restart a process it throws an error because th eport is already used by the same process in the first pm2 instance – Xanthous Sep 28 '22 at 06:37
  • Your problem is unclear. If you try to start another network process that is listening on the same port than another one, it is normal. You say you have PM2 process that runs and when you try `pm2 list` no process are shawn. Are you shure you use the same (right) system user? I guess not. If pm2 run node subprocess, you should find the account runs PM2 to log with this account and then you can use PM2 commands. – Alaindeseine Sep 28 '22 at 07:37