# Gateway Timer Scripts Not Running After DB Disconnect

**URL:** <https://forum.inductiveautomation.com/t/gateway-timer-scripts-not-running-after-db-disconnect/96400>\
**Category:** Ignition\
**Created:** [September 24, 2024, 9:33pm UTC](https://forum.inductiveautomation.com/t/gateway-timer-scripts-not-running-after-db-disconnect/96400 "2024-09-24T21:33:35Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jwieringa70](https://avatars.discourse-cdn.com/v4/letter/j/e36b37/32.png) [@jwieringa70](https://forum.inductiveautomation.com/u/jwieringa70)\
**Post date:** [September 24, 2024, 9:33pm UTC](https://forum.inductiveautomation.com/t/gateway-timer-scripts-not-running-after-db-disconnect/96400/1 "2024-09-24T21:33:35Z")

</div>

Problem:  
When a gateway timer script is running in the project and connectivity with the SQL Server is lost, the running script(s) “hang up” and will not restart or run again at the configured time.  
The time “Last Execution” column on the Gateway/Status/Gateway Scripts page will aggregate (i.e. a hung script scheduled to run every second would appear to have last ran 5 minutes ago.)  
To restart the script requires opening a script, click “Apply” and “Ok” and close and Save the project. All scripts will refresh. We have several scripts in this project to multiple remote sql connections so this can happen if any given remote connection has issues during the execution of the script.  
Question/Solution:  
Is there a scripted method for checking for any last run time for any scripts on the gateway greater than x amount of time?  
Is there a configuration to automatically restart just scripts after connectivity restoration?

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/d/a/da89085c6ecff7cb36e9b554616b03d03046f89e.png)

---

<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 24, 2024, 9:53pm UTC](https://forum.inductiveautomation.com/t/gateway-timer-scripts-not-running-after-db-disconnect/96400/2 "2024-09-24T21:53:53Z")

</div>

Have you set really long timeouts in your database connection settings?

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [September 24, 2024, 9:55pm UTC](https://forum.inductiveautomation.com/t/gateway-timer-scripts-not-running-after-db-disconnect/96400/3 "2024-09-24T21:55:43Z")

</div>

I think if you take a thread dump while this is happening you'll find that the last execution is still stuck running but blocked on some network call with a default timeout of infinity.

As Phil mentioned, these generally have to be set using some driver-specific connection setting.

---

<div class="post-metadata">

**Author:** ![jwieringa70](https://avatars.discourse-cdn.com/v4/letter/j/e36b37/32.png) [@jwieringa70](https://forum.inductiveautomation.com/u/jwieringa70)\
**Post date:** [September 25, 2024, 2:10pm UTC](https://forum.inductiveautomation.com/t/gateway-timer-scripts-not-running-after-db-disconnect/96400/4 "2024-09-25T14:10:34Z")

</div>

Thanks for the quick response. We didn't see anything specifically at the driver level.

Are you referring to to the eviction rate in the database advanced properties (attached)?

Thanks again for your assistance.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/a/0/a025a1025c38c9fe4d70cf396edc839868d7e12f.jpeg)
