At a Windows AWS server i have a NODE app and i\'m using PM2 to launch the app
I have tried the NPMs: \"pm2-windows-startup\" and \"pm2-windows-service\"
But aft
pm2-windows-startup
works great if you're okay with the fact that it is launched on login. If you have a reboot on a server though (say Windows Update) you are out of luck.
pm2-windows-service
did work for me, using @innomizetech
fork, but I've had some issues, probably due to the user or its setup, or something else. Basically the service would start an old version of the saved process list, even though I tried pm2 delete all
, pm2 start ecosystem.config.js
, pm2 save
.
I resorted to a very simple home-made solution:
pm2-resurrect.sh
in C:\
, which contains the single line pm2 resurrect
.C:\pm2-resurrect.sh
.In my case I have Git for Windows which comes with bash, which opens the file and executes it. I didn't test it but I guess you could have a .cmd
file with the same content.