# Terminate a running script in gateway

**URL:** <https://forum.inductiveautomation.com/t/terminate-a-running-script-in-gateway/63757>\
**Category:** Ignition\
**Tags:** ignition80, vision\
**Created:** [September 5, 2022, 9:43am UTC](https://forum.inductiveautomation.com/t/terminate-a-running-script-in-gateway/63757 "2022-09-05T09:43:10Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![vani161998](https://avatars.discourse-cdn.com/v4/letter/v/ee7513/32.png) [@vani161998](https://forum.inductiveautomation.com/u/vani161998)\
**Post date:** [September 5, 2022, 9:43am UTC](https://forum.inductiveautomation.com/t/terminate-a-running-script-in-gateway/63757/1 "2022-09-05T09:43:10Z")

</div>

Hi All,  
Is there any way to terminate a running script ?  
i was testing a script with system.util.invokeAsynchronous function .  
i have disabled all my codes and tag change properties,but still the script is running .

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [September 5, 2022, 9:49am UTC](https://forum.inductiveautomation.com/t/terminate-a-running-script-in-gateway/63757/2 "2022-09-05T09:49:03Z")

</div>

You could try opening a console and pressing Ctrl+C

I’ve seen that mentioned in a few other forum posts

---

<div class="post-metadata">

**Author:** ![vani161998](https://avatars.discourse-cdn.com/v4/letter/v/ee7513/32.png) [@vani161998](https://forum.inductiveautomation.com/u/vani161998)\
**Post date:** [September 5, 2022, 9:53am UTC](https://forum.inductiveautomation.com/t/terminate-a-running-script-in-gateway/63757/3 "2022-09-05T09:53:03Z")

</div>

i am not running from script console.  
i have written my script inside project library and triggered using a tag change.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [September 5, 2022, 1:49pm UTC](https://forum.inductiveautomation.com/t/terminate-a-running-script-in-gateway/63757/4 "2022-09-05T13:49:28Z")

</div>

There is no safe way. If you can get a reference to the thread, you can use `.interrupt()`. But that is not assured due to the nature of java threads.

You _ **must** _ design your long-running threads to be interruptible, or to automatically die after a time limit, or some other housekeeping method. This is also required to prevent memory leaks when code changes.

In the meantime, you will probably have to restart the gateway.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [September 6, 2022, 3:43pm UTC](https://forum.inductiveautomation.com/t/terminate-a-running-script-in-gateway/63757/5 "2022-09-06T15:43:23Z")

</div>

The easiest way is absolutely to restart the gateway.

That said, some changes we made in the 8.X line might make this possible, depending on your exact version:

> [@Thread Descriptions in Diagnostics Menu](https://forum.inductiveautomation.com/t/thread-descriptions-in-diagnostics-menu/36264/2):
>
> For the first request, changes are coming soon - possibly as soon as 8.0.15. Right now, there’s no way to set that description, but there will just be a description keyword argument to provide on your system.util.invokeAsynchronous calls. For the latter: from com.inductiveautomation.ignition.common.script import ScriptManager for script in ScriptManager.executingScripts(): if script.description == "My Async Thread": ScriptManager.interrupt(script.threadId)
