I using pm2. After I started my app several times, the id increased. I deleted all in pm2, and started again, but the id didn't count from 0 any more. How can I reset it?
How to reset the id of pm2?
The solution is to restart pm2, by typing pm2 kill
as said by ItalyPaleAle in the comments.
Looking at the help menu (pm2 --help
) it seems like pm2 reset
would be the way to go. But that command resets metadata (restarted time, etc) and does not reset IDs. One solution is to use pm2 kill
to kill the pm2 daemon and restart it again (thanks, @Yao Zhao). But doing so will stop all current processes. A better approach would be to save the list of current processes, restart pm2, and then restore those processes using the following set of commands.
$ pm2 save # save current processes
$ pm2 kill # kill pm2 daemon
$ pm2 resurrect # load saved processes
I need to clean up the process id list (due to recent additional apps). This is exactly what I need. All process ID list now in sequence. It was not before due to issues getting the new app up to work. Great! Thank! –
Commendation
Per pm2's GitHub:
$ pm2 reset <process> # Reset meta data (restarted time...)
Reference: GitHub issue#1456
The Question is about resetting the "id" counter, not the metadata of a process. –
Pandorapandour
© 2022 - 2024 — McMap. All rights reserved.