Announcement

Collapse
No announcement yet.

Scripts to stop/start hs3 in Windows?

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

    Scripts to stop/start hs3 in Windows?

    Recently I’ve been having issues with things like log file corrupting and plugins stopping being able to write to database, etc. After digging and soul searching, I’ve realized that a lot of it seems to coincide timing wise with when I started doing nightly backups of my hs3 server to my synology nas. It occurs to me that if the backup agent is fighting with the dB or plugins for access, it could be causing the issues.

    The software supports pre and post backup scripts - wondering if anyone has any suggestions for code (or other scripted method) to stop homeseer, and restart it again after the backup completes?


    regards,

    Paul

    #2
    Two suggestions:
    1. Take a look at BLBackup plug-in. It's free and I've not heard of it causing problems like you are experiencing.
    2. I'm using CFGuy's "Resart" plug-in. It provides the ability to restart or shutdown HS, and reboot or shutdown the HS server. It provides a user-specified delay before restarting the plug-in. (BLShutdown may have a similar provisions, but I have no experience with it.)
    Mike____________________________________________________________ __________________
    HS3 Pro Edition 3.0.0.548, NUC i3

    HW: Stargate | NX8e | CAV6.6 | Squeezebox | PCS | WGL 800RF | RFXCOM | Vantage Pro | Green-Eye | Edgeport/8 | Way2Call | Ecobee3 | EtherRain | Ubiquiti

    Comment


      #3
      PS. Autoit will allow you to create script-like control of windows, including shutting down and starting applications. There's a learning curve, but its pretty robust.
      Mike____________________________________________________________ __________________
      HS3 Pro Edition 3.0.0.548, NUC i3

      HW: Stargate | NX8e | CAV6.6 | Squeezebox | PCS | WGL 800RF | RFXCOM | Vantage Pro | Green-Eye | Edgeport/8 | Way2Call | Ecobee3 | EtherRain | Ubiquiti

      Comment


        #4
        Hmm... Interesting. I'll checkout the plugins - if they do the job I'd rather do that then run external scripts. That being said, since posting this message, I did some digging (I'm not a Windows batch script kinda guy) and managed to hack together the following two scripts that do appear to work:

        hs3stop.bat:
        Code:
        REM Check if HS3 is running and close
        tasklist /FI "IMAGENAME eq HS3.exe" 2>NUL | find /I /N "HS3.exe" >NUL
        if "%ERRORLEVEL%"=="0" taskkill /IM HS3.exe
        
        REM Check if HS3 Speaker is running and close
        tasklist /FI "IMAGENAME eq speaker.exe" 2>NUL | find /I /N "speaker.exe" >NUL
        if "%ERRORLEVEL%"=="0" taskkill /IM speaker.exe
        
        REM Check if Abode Connector is running and close
        tasklist /FI "IMAGENAME eq python.exe" 2>NUL | find /I /N "python.exe" >NUL
        if "%ERRORLEVEL%"=="0" taskkill /IM python.exe
        hs3start.bat
        Code:
        REM Check if HS3 is stopped, and start it
        tasklist /FI "IMAGENAME eq HS3.exe" 2>NUL | find /I /N "HS3.exe" >NUL
        if "%ERRORLEVEL%"=="1" cd "C:\Program Files (x86)\Homeseer HS3" & start HS3.exe
        Just for posterity in case anyone is interested in them. If you're wondering about the 'python.exe' bit, that's for a python script I wrote that runs in the background and acts as a connector between HS3 and my Abode security system (I don't know enough vb to write a plugin).

        Now to go check out those other plugins....

        Paul

        Comment


          #5
          I'm concerned that using "taskkill" to terminate the HS3 executable could cause more problems than it solves in this case.
          Mike____________________________________________________________ __________________
          HS3 Pro Edition 3.0.0.548, NUC i3

          HW: Stargate | NX8e | CAV6.6 | Squeezebox | PCS | WGL 800RF | RFXCOM | Vantage Pro | Green-Eye | Edgeport/8 | Way2Call | Ecobee3 | EtherRain | Ubiquiti

          Comment


            #6
            Originally posted by Uncle Michael View Post
            I'm concerned that using "taskkill" to terminate the HS3 executable could cause more problems than it solves in this case.
            Well, I was a little cautious. The default behaviour of taskkill is to gracefully send the application the signal to shutdown, and indeed I've watched everything cleanly close up. It's the equivalent of hitting the red X on the upper right corner of the window. If you add a /F (Force) flag to it, then it'll cause a hard kill, which indeed I suspect would cause issue.

            Under the above circumstances, do you still forsee other potential issues?

            regards,

            Paul

            Comment


              #7
              I didn't realize there was a non-force mode. If it behaves like the window close button, then it's not doing what I was afraid it was.
              Mike____________________________________________________________ __________________
              HS3 Pro Edition 3.0.0.548, NUC i3

              HW: Stargate | NX8e | CAV6.6 | Squeezebox | PCS | WGL 800RF | RFXCOM | Vantage Pro | Green-Eye | Edgeport/8 | Way2Call | Ecobee3 | EtherRain | Ubiquiti

              Comment

              Working...
              X