Announcement

Collapse
No announcement yet.

How do I stop / teminate a running Script

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

  • How do I stop / teminate a running Script

    Hi

    When I tried to re-run a very short script I recently coded I got the following error message:

    I then tried : &hs.writelog("Scripts", hs.scriptsrunning)


    Not running script since its already running: /usr/share/HomeSeer/scripts/HouseTime.vb Single instance option enabled in event properties

    to find that I had 3 scripts still running from days ago. The common thread being that all had errors during the debugging process.

    I could restart but is there a way of stopping / terminating running scripts ?

    Thank you




  • #2
    Check your Setup page. The check box next to scripts cannot timeout should not be checked. You should get a warning if a script runs more than about 30 sec.
    Attached Files
    Mike____________________________________________________________ __________________
    HS3 Pro Edition 3.0.0.548

    HW: Stargate | NX8e | CAV6.6 | Squeezebox | PCS | WGL 800RF, Rain8Net+ | RFXCOM | QSE100D | Vantage Pro | Green-Eye | X10: XTB-232, -IIR | Edgeport/8 | Way2Call | Ecobee3

    Comment


    • #3
      Thank you. I don't have that option (running 3.0.0.293pro in Linux).

      Comment


      • #4

        Comment


        • #5
          Originally posted by SgtBilko View Post
          Thank you. I don't have that option (running 3.0.0.293pro in Linux).

          Same here, running Linux 3.0.0.297 pro. That checkbox must only be a Windows option.

          So anyone know how to kill a running script on HS3 Linux version?

          Comment


          • #6
            > ps aux | grep "string from script name"

            That will return data including the PID.

            > sudo kill "PID #"

            Comment


            • #7
              Originally posted by mikaluch View Post
              > ps aux | grep "string from script name"

              That will return data including the PID.

              > sudo kill "PID #"

              Thank you

              Comment


              • #8
                I'm running HS3 on Windows and even if I have the options selected as shown above my script won't timeout by some reason.

                Is it possible to somewhere see which scripts that are currently running?

                Comment


                • #9
                  Originally posted by Freddan101 View Post
                  I'm running HS3 on Windows and even if I have the options selected as shown above my script won't timeout by some reason.

                  Is it possible to somewhere see which scripts that are currently running?
                  The timeout option is only relevant to the older VBScript (i.e. scripts with a .txt and .vbs extension). To my knowledge, there is no way to terminate a VB.NET script in Windows without shutting down Homeseer. To be honest, it has to be poor programming if a script never terminates.

                  Running the following immediate script command from the control panel will list the scripts running:

                  &hs.writelog("Scripts", hs.scriptsrunning)
                  Jon

                  Comment


                  • #10
                    Originally posted by jon00 View Post
                    The timeout option is only relevant to the older VBScript (i.e. scripts with a .txt and .vbs extension). To my knowledge, there is no way to terminate a VB.NET script in Windows without shutting down Homeseer. To be honest, it has to be poor programming if a script never terminates.

                    Running the following immediate script command from the control panel will list the scripts running:

                    &hs.writelog("Scripts", hs.scriptsrunning)
                    Haha, yes I can't argue about poor programming. I've just started to experiment with scripting in HomeSeer. I have a background in programming (far back) but as the info is so fragmented on the forum it takes a bit of experimenting to get going. Also it's a sometimes hard to see if the examples you find is for VBScript or VB.NET.

                    Anyway, my function started with "Sub Main()" and not "Sub Main(params as Object)" which made the script run forever.

                    Comment


                    • #11
                      I can't see the script running in ps aux

                      when I use &hs.writelog("Scripts", hs.scriptsrunning) I see the script running but when I use ps aux | grep "nameofscript" nothing comes up except for the grep process that looks for that string.

                      Running on Linux Debian Jessie. Sudo not installed. running HS as root account

                      Comment


                      • #12
                        What are you trying to achieve? Unless a script is misbehaving, it will terminate after execution. Most small scripts will complete between 5-100ms.
                        Jon

                        Comment


                        • #13
                          My understanding is that the scripts run inside the HS3 process, not as separate processes, so the only way to stop a running script is to restart HS. I use virtual devices with some scripts where the script checks the status of the virtual device and will terminate if the virtual device becomes a certain value. This would only work if the script is stuck in the loop where that value is evaluated.

                          Cheers
                          Al
                          HS 3.0.0.548: 1965 Devices 1146 Events
                          Z-Wave 3.0.1.262: 122 Nodes on one Z-Net

                          Comment


                          • #14
                            Originally posted by jon00 View Post
                            What are you trying to achieve? Unless a script is misbehaving, it will terminate after execution. Most small scripts will complete between 5-100ms.
                            I made the same mistake as Freddan101 in the 10th comment. My script started with "Sub Main()" and not "Sub Main(params as Object)" which made the script run forever.

                            Originally posted by sparkman View Post
                            My understanding is that the scripts run inside the HS3 process, not as separate processes, so the only way to stop a running script is to restart HS.
                            That's sounds very logical. I should have tested it in Vs/tenscripting but I though this could not go wrong

                            Comment

                            Working...
                            X