Announcement

Collapse
No announcement yet.

How can I remotely test node-red is running, and if not restart it ?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    How can I remotely test node-red is running, and if not restart it ?

    I run HS4 on a dedicated PC, which also runs Node-red. I am just starting with Node-red, so have nothing critical running on it yet, but the more I rely on it the more important it is that it is running all the time. Today coming home I noticed Node-red was not running, it must have crashed as HS4 was still running normally (and I get a notification if it reboots, and node-red runs as a service so starts with the PC).
    So, the question is, how can I set up a event which checks automatically if Node red is running, and if it isnt, is there a way to restart node-red without having to open power shell on the pc to start it manually. If I am at home and it happend I can open teamviewer to access the PC and start node-red, but if I am not or if it happens at night that is not really an option

    #2
    Install Docker and keep Node-RED out of the Windows PC. I have already mentioned it here : https://forums.homeseer.com/forum/ho...-4#post1419277

    You also don't have to use the MQTTbundled with mscMQTT. Things should just work! Just point mscMQTT to where the MQTT server is.



    Tip : You may find a solution here : https://www.google.com/search?client...ing+in+Windows




    Eman
    TinkerLand : Life's Choices,"No One Size Fits All"

    Comment


      #3
      You'll get a websocket error in your log when HS can't send an update to node red. I recently set up Jon00's HS4 log monitor. When it matches the log error I have it trigger an event that sends me a push notification so I can reboot node red. That gets you half way there.

      As for automating a reboot/restart of node red. I've seen mention of ways to run external programs from HS; just never done it before outside of running a bat from startup script. Maybe set up a bat or powershell to start Node Red when your event gets triggered. I know there are also ways, outside of HS, to monitor a program and restart it if it dies. Task scheduler may have that function.
      HS4 Pro on Shuttle NC10U, Win10; Z-NET
      Number of Devices: 1005
      Number of Events: 293

      Plug-Ins: BLLock, DirecTv, EasyTrigger, Honeywell WiFi Thermostat, Marquis monoprice Amp, MeiHarmonyHub, PHLocation2, Pushover 3P, UltraM1G3, rnbWeather, Worx Landroid, Z-Wave

      External applications: Homebridge-homeseer, Geofency, EgiGeoZone.

      Comment


        #4
        You can run node red as service under Windows, method here:

        https://gist.github.com/dceejay/576b4847f0a17dc066db

        Then you can then set the recovery options just like any other windows service, an example here:

        Click image for larger version

Name:	Capture.PNG
Views:	284
Size:	42.5 KB
ID:	1419770

        Hope this helps,

        -TC1

        Comment


          #5
          I got a chuckle reading the documentation like you provided. NSSM - the Non-Sucking Service Manager

          Comment


            #6
            Originally posted by TC1 View Post
            You can run node red as service under Windows, method here:

            https://gist.github.com/dceejay/576b4847f0a17dc066db

            Then you can then set the recovery options just like any other windows service, an example here:

            Click image for larger version

Name:	Capture.PNG
Views:	284
Size:	42.5 KB
ID:	1419770

            Hope this helps,

            -TC1
            I do run node red as a service, I did not know you can set these recovery options. Just have to have a look where I can set this but I should be able to find it. That should help, together with an alert as jmaddox suggested when I get a websocket error in the log.

            Comment


              #7
              Originally posted by mikee123 View Post

              I do run node red as a service, I did not know you can set these recovery options. Just have to have a look where I can set this but I should be able to find it. That should help, together with an alert as jmaddox suggested when I get a websocket error in the log.
              In windows you want to run Services.msc
              Then find the service you are running and check the properties for it.

              Comment


                #8
                Originally posted by TC1 View Post
                You can run node red as service under Windows, method here:

                https://gist.github.com/dceejay/576b4847f0a17dc066db

                Then you can then set the recovery options just like any other windows service, an example here:

                Click image for larger version

Name:	Capture.PNG
Views:	284
Size:	42.5 KB
ID:	1419770

                Hope this helps,

                -TC1
                I had a look, I found my monocle service (nothing to do with node red but wanted to also enable restart if it fails) but cannot find the node red service. I know I have node red running as a service, but its not in the list of services. What would it be called ?

                Comment


                  #9
                  Are you using another utility to launch NR as a service? i'm only asking because I don't have NR running. If using another utility then look for that as the service name.

                  Comment

                  Working...
                  X