Open marklagendijk opened 9 years ago
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
.
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.