Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PM2 deleted process runs on startup

Tags:

node.js

nginx

pm2

I have a pm2 process named app that was used to test the configuration.

I noticed app was starting when the system rebooted, and it was causing errors with the real application.

I ran:

 pm2 delete app

then I ran:

 pm2 list

and it didn't show app.

When I reboot my system, the app is still there and it is running. I attempted to find information on where the config file is online, and there is no information other than creating a template config file. Where should the config file that pm2 reads on startup be located on an Ubuntu system, or why isn't delete working as I intend? Is there another method or command I can use to remove a pm2 process or am I looking at this incorrectly?

like image 731
David Kamer Avatar asked Oct 06 '18 21:10

David Kamer


1 Answers

If you use "pm2 delete {appname}" to delete the last app

pm2 delete app

when you run

pm2 save

It will show

[PM2] Saving current process list...
[PM2] Nothing to save !!!
[PM2] In this case we keep old dump file. To clear dump file you can delete it manually !

Which means, actually, the last app information is still not deleted.

The solution is to create a new dump file.

pm2 cleardump

Then, the app will be deleted permanently.

You can check the pm2 file to see what's actually saved into dump file.

/home/ubuntu/.pm2/dump.pm2
like image 117
Robin Ding Avatar answered Nov 15 '22 23:11

Robin Ding