Announcement

Collapse
No announcement yet.

How do I stop / teminate a running Script

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

  • 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:


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

    Leave a comment:


  • Uncle Michael
    replied
    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

    Leave a comment:


  • SgtBilko
    started a topic How do I stop / teminate a running Script

    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



Working...
X