PM2 deleted process runs on startup

David Kamer picture David Kamer · Oct 6, 2018 · Viewed 9.1k times · Source

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?

Answer

Robin Ding picture Robin Ding · Feb 9, 2019

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