# Gateway scripts stop running FTP

**URL:** <https://forum.inductiveautomation.com/t/gateway-scripts-stop-running-ftp/18380>\
**Category:** Ignition\
**Tags:** ignition79, scripting\
**Created:** [June 10, 2018, 10:12pm UTC](https://forum.inductiveautomation.com/t/gateway-scripts-stop-running-ftp/18380 "2018-06-10T22:12:45Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![albetro.15](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/albetro.15/32/3922_2.png) [@albetro.15](https://forum.inductiveautomation.com/u/albetro.15)\
**Post date:** [June 10, 2018, 10:12pm UTC](https://forum.inductiveautomation.com/t/gateway-scripts-stop-running-ftp/18380/1 "2018-06-10T22:12:45Z")

</div>

I have a series of scripts in the gateway that at som point stop. As pointed in [Gateway Timer scripts mysteriously stopped](http://forum.inductiveautomation.com/t/gateway-timer-scripts-mysteriously-stopped/7453) it is very likely it is due to a ftp socket that doesnt respond and so the system is stuck (most of these scripts are to connecto to ftp ). Is there any way or a workaround to specify the timeout time in ignition? The ftp lib included in this version of jython apparently doesnt include option yet.

Thanks in advance !

---

<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:** [June 11, 2018, 11:32am UTC](https://forum.inductiveautomation.com/t/gateway-scripts-stop-running-ftp/18380/2 "2018-06-11T11:32:29Z")

</div>

Consider using native Java’s `java.net.URL` and `java.net.URLConnection` instead of the python lib.

---

<div class="post-metadata">

**Author:** ![albetro.15](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/albetro.15/32/3922_2.png) [@albetro.15](https://forum.inductiveautomation.com/u/albetro.15)\
**Post date:** [June 22, 2018, 12:46pm UTC](https://forum.inductiveautomation.com/t/gateway-scripts-stop-running-ftp/18380/3 "2018-06-22T12:46:29Z")

</div>

Thanks for the answer pturmel, thats the kind of tools i was looking for !

---

<div class="post-metadata">

**Author:** ![kavya\_shree](https://avatars.discourse-cdn.com/v4/letter/k/b4bc9f/32.png) [@kavya\_shree](https://forum.inductiveautomation.com/u/kavya_shree)\
**Post date:** [January 30, 2023, 12:00pm UTC](https://forum.inductiveautomation.com/t/gateway-scripts-stop-running-ftp/18380/4 "2023-01-30T12:00:24Z")

</div>

Hi,  
I have written insert query with hard coded values in gateway event script - I have scheduled itto run for every 15 mins.  
It is inserting but not able to stop.

how to stop the script which is running

Thank you

---

<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:** [January 30, 2023, 1:36pm UTC](https://forum.inductiveautomation.com/t/gateway-scripts-stop-running-ftp/18380/5 "2023-01-30T13:36:25Z")

</div>

By "scheduled to run", do you mean you started a script that loops forever? If so, you'll have to restart your gateway to kill it.

Use Ignition's events to run your script. Don't loop in the script. Just do the one insert. Let Ignition call the script every fifteen minutes.

If you must run a long-lived script, you must take special precautions to ensure it dies when you ask it to, and can be replaced when you update the code.
