Announcement

Collapse
No announcement yet.

How do I stop / teminate a running Script

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

  • jon00
    replied
    So to stop this happening you should put error handling in your function and provide a return when this happens.

    Example:

    Code:
    Function Test(ByVal Parm As Object)
    Try
    ' Your code here
    Catch
    End Try
    Return ""
    End Function
    If you do this, you won't have the issue.

    Leave a comment:


  • LeeIII
    replied
    Originally posted by jon00 View Post
    I have no control unfortunately. Because check_vcmd2.vb is also showing as running, I suspect you have something programmed in Jon00Alexa which is not running correctly; such as your own scripts. You may have to disable the triggers until you find the culprit.
    I thought I was clear but maybe not. My script crashed with error. It was called by Jon00Alexa. But apparently when that happens your script doesn’t know that and it goes into an infinite wait until HS times out your Jon00Alexa.

    When i was troubleshooting that - it requires me to either wait for that or to restart homeseer.

    I was searching for help on this issue when I ran across your comment about scripts that should never timeout. Guess that doesn’t apply to this situation. 🤷🏻‍♂️


    Sent from my iPhone using Tapatalk

    Leave a comment:


  • jon00
    replied
    I have no control unfortunately. Because check_vcmd2.vb is also showing as running, I suspect you have something programmed in Jon00Alexa which is not running correctly; such as your own scripts. You may have to disable the triggers until you find the culprit.

    Leave a comment:


  • LeeIII
    replied
    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)
    Hi Jon, Perhaps you could help me with an interesting situation. Ironically, it's with Jon00Alexa script. If I invoke via Jon00Alexa a script that I write, and it errors out with some error in the log file, very often, your script has to fully timeout in Homeseer. Is there any way to terminate your script? Otherwise, It has to hit the HomeSeer timeout feature and then get terminated.

    Jun-07 9:19:37 AM Scripts Running Jon00AlexaASPX.vben,check_vcmd2.vb,Jon00Alexa.vben
    Jun-07 9:19:37 AM System Control Panel Immediate Script: &hs.writelog("Scripts Running", hs.scriptsrunning)


    Appreciate the suggestion in advance.

    --Lee III

    Leave a comment:


  • alan_smithee
    replied
    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

    Leave a comment:


  • sparkman
    replied
    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

    Leave a comment:


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

    Leave a comment:


  • alan_smithee
    replied
    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

    Leave a comment:


  • Freddan101
    replied
    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.

    Leave a comment:


  • jon00
    replied
    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)

    Leave a comment:


  • Freddan101
    replied
    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?

    Leave a comment:


  • SgtBilko
    replied
    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

    Leave a comment:


  • mikaluch
    replied
    > ps aux | grep "string from script name"

    That will return data including the PID.

    > sudo kill "PID #"

    Leave a comment:


  • AutomatedJim
    replied
    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?

    Leave a comment:


  • SgtBilko
    replied

    Leave a comment:

Working...
X