node-pm2-windows-startup
node-pm2-windows-startup copied to clipboard
Start using a service instead of startup registry entry
Currently pm2 resurrect is called via a command which runs based on registry startup entry. The problem with this approach is that it only runs after a user has logged in. This a a problem for servers.
Probably the solution to this is to trigger the pm2 resurrect command via a Windows service. This could be implemented using node-windows.
Winser also looks very interesting. pm2 also can be used programmatically, so the following should work:
index.js:
var pm2 = require('pm2');
pm2.resurrect();
package.json
{
"scripts": {
"postinstall": "winser -i -s -c",
"preuninstall": "winser -r -x -s",
}
}
With this installing should just be a matter of npm install pm2-windows-startup -g and uninstalling of npm uninstall pm2-windows-startup -g.