How can I restart NR after crash (Windows)

Hi, my work is based on node-red-contrib-kodi which unfortunately has bugs and authos gave up on updating it. These bugs makes NR crash, so I'm looking for a way to restart NR after crashing occuring under DOS, how can I get aware that NR quitted to restart it? I guess the beast way is to use a batch file.
Thank you a lot for your suggestions

Much better running it as a service. Search forum for nssm.

A service can have recovery options
image

PM2 is also an option folk use instead of a true service.

1 Like

I use PM2 to run my dev instance of Node-RED on Windows. One of its advantages is that you can get it to auto-restart when particular files change which is good for development in Node-RED.

The other advantage is that PM2 handles logs for you in a rather more predictable way than Windows.

Of course, it is possible to combine running PM2 as a service or indeed, simply start it using the Windows task scheduler.

1 Like

Thank you mates for answers, I've found PM2 a very convenient way, quickly, to use it under Windows I used the following commands:

npm install pm2 -g
npm install pm2-windows-startup -g
pm2-startup install
pm2 start C:\Users<USER-NAME>\AppData\Roaming\npm\node_modules\node-red\red.js (use your path)
pm2 save

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.