pm2
pm2 copied to clipboard
Issue with PM2 and SSH connection
I am using PM2 to watch/run my node.js application on a windows server 2019. For deployment I do:
- pm2 delete all
- git pull origin
- pm2 resurrect
This correctly restarts all 3 processes of my app with the saved configuration.
Sometimes there are some "ghost" processes remaining active that produce mixed results (new code and old code running in parallel). So I have decided to add a taskkill /FI "imagename eq node.exe" /F before the resurrect. This effectively kills all remaining processes (unfortunately also the pm2 daemon process).
I start this deployment via a SSH connection to the server.
If I now start the PM2 daemon process and do the resurrect it all seems well. Until I logoff via SSH. Then the daemon process and its children get killed.
How can I start the daemon process so that it does not run on the current ssh connection process?
https://pm2.keymetrics.io/docs/usage/startup/