# Gateway Scheduled Script executed twice unexpectedly

**URL:** <https://forum.inductiveautomation.com/t/gateway-scheduled-script-executed-twice-unexpectedly/113786>\
**Category:** Ignition\
**Tags:** ignition81, scripting\
**Created:** [February 5, 2026, 3:13pm UTC](https://forum.inductiveautomation.com/t/gateway-scheduled-script-executed-twice-unexpectedly/113786 "2026-02-05T15:13:54Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![bmeyers](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bmeyers/32/37453_2.png) [@bmeyers](https://forum.inductiveautomation.com/u/bmeyers)\
**Post date:** [February 5, 2026, 3:13pm UTC](https://forum.inductiveautomation.com/t/gateway-scheduled-script-executed-twice-unexpectedly/113786/1 "2026-02-05T15:13:54Z")

</div>

I have a v8.1.32 Gateway Schedule Script set to run at midnight.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/6/6/66382c3b5a8f6f9ef8ff645535ee191aace54474.png)

It inserts some data into a database through a named query. I didn't have logging in before this incident but I have it in now.

I can't figure out why it would have executed twice but my only theory is it has to do with running a redundant server or my server clock got set to midnight unexpectedly. Is there anything in the logs i can look for to diagnose what might have happened?

The data gets inserted into the database with the timestamp of midnight hard-coded since the script is executing only at midnight so I can't diagnose the issue from the timestamp alone on this one. The data sent to the database was different enough to indicate a gap of 6 or 7 hours at minimum from the first entry to the second.

I am lost on this one. Any advice / thoughts are appreciated.

---

<div class="post-metadata">

**Author:** ![bkarabinchak.psi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bkarabinchak.psi/32/83567_2.png) [@bkarabinchak.psi](https://forum.inductiveautomation.com/u/bkarabinchak.psi)\
**Post date:** [February 5, 2026, 3:39pm UTC](https://forum.inductiveautomation.com/t/gateway-scheduled-script-executed-twice-unexpectedly/113786/2 "2026-02-05T15:39:46Z")

</div>

Show your script, and if there are no logs in your script that are like “Beginning Midnight Process” etc I would highly encourage adding something like that.

Good practice for gateway scripts is to log out the start time and params if any used, and when it ends, along with elapsed time, its often useful to know how fast a script runs.

> [@bmeyers](#):
>
> The data gets inserted into the database with the timestamp of midnight hard-coded since the script is executing only at midnight so I can't diagnose the issue from the timestamp alone on this one.

Also wouldn’t do this because of the exact scenario you’re running into now. Just let the db use CURRENT\_TIMESTAMP or use a system.db.now() to feed into your named query and then right now you’d be seeing exactly when each ran.

---

<div class="post-metadata">

**Author:** ![Bushmatic](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bushmatic/32/87014_2.png) [@Bushmatic](https://forum.inductiveautomation.com/u/Bushmatic)\
**Post date:** [February 5, 2026, 3:56pm UTC](https://forum.inductiveautomation.com/t/gateway-scheduled-script-executed-twice-unexpectedly/113786/4 "2026-02-05T15:56:51Z")

</div>

Is it an inheritable project with one child project?

---

<div class="post-metadata">

**Author:** ![bmeyers](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bmeyers/32/37453_2.png) [@bmeyers](https://forum.inductiveautomation.com/u/bmeyers)\
**Post date:** [February 5, 2026, 4:12pm UTC](https://forum.inductiveautomation.com/t/gateway-scheduled-script-executed-twice-unexpectedly/113786/5 "2026-02-05T16:12:55Z")

</div>

After further investigation it appears some of the other Gateway Event Scripts executed twice multiple times yesterday.

I have another script that executes every 3 hours but the duplicates only occurred at 6 pm, 9 pm, midnight, 3 am, and 6am. All other entries as far back as two weeks ago look ok.

I highlighted the duplicate entries below in blue (this is the results of a separate gateway script)... I'm not going to share the full script(s) as there is some proprietary information in them.

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

---

<div class="post-metadata">

**Author:** ![Nol](https://avatars.discourse-cdn.com/v4/letter/n/8e8cbc/32.png) [@Nol](https://forum.inductiveautomation.com/u/Nol)\
**Post date:** [February 5, 2026, 4:17pm UTC](https://forum.inductiveautomation.com/t/gateway-scheduled-script-executed-twice-unexpectedly/113786/6 "2026-02-05T16:17:21Z")

</div>

Are your servers actually configured as redundant and not two independent servers? Probably not but worth a check.

And inside your script at the very end does it call itself again? Sometimes when testing things in script console it's common to put the script def in there and then have to call it in order for it to run. Could be a copy paste error moving it into the library where it calls itself a second time.

---

<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:** [February 5, 2026, 4:26pm UTC](https://forum.inductiveautomation.com/t/gateway-scheduled-script-executed-twice-unexpectedly/113786/7 "2026-02-05T16:26:15Z")

</div>

Any chance someone took a gateway backup and restored it on their own machine for testing/development?

---

<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:** [February 5, 2026, 4:26pm UTC](https://forum.inductiveautomation.com/t/gateway-scheduled-script-executed-twice-unexpectedly/113786/8 "2026-02-05T16:26:33Z")

</div>

Look for logs suggesting loss of master-backup comms. This might be a split-brain scenario, where the gateways lose contact with each other, but can still talk to devices and database.

---

<div class="post-metadata">

**Author:** ![bmeyers](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bmeyers/32/37453_2.png) [@bmeyers](https://forum.inductiveautomation.com/u/bmeyers)\
**Post date:** [February 5, 2026, 4:30pm UTC](https://forum.inductiveautomation.com/t/gateway-scheduled-script-executed-twice-unexpectedly/113786/9 "2026-02-05T16:30:51Z")

</div>

Yes, servers are configured as redundant.

I was looking at another gateway script that failed and narrowed the timeframe down to around 3:30 pm to 6:30 am the following morning. Here is a screenshot from the logs around 3:20 pm.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/8/8/881c842fd47e5b16d151190d4417f83f868d182a.png)

A lot of errors / messages that I don't recognize. Not sure if I should open an official ticket with Ignition at this point.

@paul-griffith Always a chance 🙂

@pturmel Yes, I am seeing some logs that might suggest this is what happened.

---

<div class="post-metadata">

**Author:** ![tgarrison](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/tgarrison/32/80965_2.png) [@tgarrison](https://forum.inductiveautomation.com/u/tgarrison)\
**Post date:** [February 5, 2026, 4:32pm UTC](https://forum.inductiveautomation.com/t/gateway-scheduled-script-executed-twice-unexpectedly/113786/10 "2026-02-05T16:32:40Z")

</div>

Look at the log on the other server for the same timeframe. See if it also thinks the connection went down. If they both are "Active" it's the split-brain scenario Phil mentioned. Which is a bad thing and causes havoc.

---

<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:** [February 5, 2026, 4:39pm UTC](https://forum.inductiveautomation.com/t/gateway-scheduled-script-executed-twice-unexpectedly/113786/11 "2026-02-05T16:39:27Z")

</div>

> [@bmeyers](#):
>
> might suggest this is what happened

Are your gateways on the same subnet, physically close to each other? If not, fix that. See this:

> [@Architecture for Distributed Control Center](https://forum.inductiveautomation.com/t/architecture-for-distributed-control-center/85104/9):
>
> Ignition redundancy is both latency sensitive and subject to split brain syndrome. If the comms goes down between sites, both servers will end up active and therefore numerous properties start to diverge. So let me amend my answer to: Ignition redundant servers must be installed on a common LAN with a robust network layout (preferably multi-path, like RTSP), such that any loss of comms also results in loss of comms to all clients and all devices and all databases. (Trunk port for multiple VL…

More:

[https://forum.inductiveautomation.com/search?q=%40pturmel%20split%20brain%20order%3Alatest](https://forum.inductiveautomation.com/search?q=%40pturmel%20split%20brain%20order%3Alatest)

---

<div class="post-metadata">

**Author:** ![bmeyers](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bmeyers/32/37453_2.png) [@bmeyers](https://forum.inductiveautomation.com/u/bmeyers)\
**Post date:** [February 5, 2026, 4:42pm UTC](https://forum.inductiveautomation.com/t/gateway-scheduled-script-executed-twice-unexpectedly/113786/12 "2026-02-05T16:42:13Z")

</div>

I'll have to reach out to the customer and get the answers from them. I was not in charge of the architecture setup or configuration and they have some weird security that limits my actions.

I'll update this thread at some point with whatever answers i find.

---

<div class="post-metadata">

**Author:** ![Nol](https://avatars.discourse-cdn.com/v4/letter/n/8e8cbc/32.png) [@Nol](https://forum.inductiveautomation.com/u/Nol)\
**Post date:** [February 5, 2026, 4:48pm UTC](https://forum.inductiveautomation.com/t/gateway-scheduled-script-executed-twice-unexpectedly/113786/13 "2026-02-05T16:48:18Z")

</div>

We have a similar issue tbh that I've been trying to diagnose and haven't made much leeway. Both servers are physically stacked on top of each other and on the same network and such so shouldn't be any network concerns but they drop out of sync with similar errors every once in a while. Going to try and update the 3rd party modules as see if it's maybe being caused by those but otherwise not sure at the moment and need to bug support when I get time to deal with it.
