# Gateway Event Script Schedule

**URL:** <https://forum.inductiveautomation.com/t/gateway-event-script-schedule/88684>\
**Category:** Ignition\
**Tags:** ignition81, scripting\
**Created:** [April 11, 2024, 10:46am UTC](https://forum.inductiveautomation.com/t/gateway-event-script-schedule/88684 "2024-04-11T10:46:49Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vatsal\_Shah](https://avatars.discourse-cdn.com/v4/letter/v/0ea827/32.png) [@Vatsal\_Shah](https://forum.inductiveautomation.com/u/Vatsal_Shah)\
**Post date:** [April 11, 2024, 10:46am UTC](https://forum.inductiveautomation.com/t/gateway-event-script-schedule/88684/1 "2024-04-11T10:46:49Z")

</div>

I want to run a script on gateway for the following time - (0,1,2,3,4,5,6,7,8,9,10,11,12,13:30,22:30,23) what inputs should I enter in Gateway Schedule Scripts console ?

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [April 11, 2024, 11:09am UTC](https://forum.inductiveautomation.com/t/gateway-event-script-schedule/88684/2 "2024-04-11T11:09:12Z")

</div>

I think you have two options:

1. Create two schedules:  
`0 0-12,23 * * *` for the on-the-hour events.  
`30 13,22 * * *` for the 30 minutes past the hour events.  
Both would call the same script. This has the disadvantage that you have to maintain two copies of the script.
2. Run the script every 30 minutes and exit out if it's not one of the required times.  
`0,30 * * * *`  
The script could be something like this (but the Python guys should be able to improve it):

```auto
hh = system.date.getHour24(system.date.now())
mm = system.date.getMinute(system.date.now())
# 13:30 and 22:30
if mm == 30:
     if not hh in [13, 22]:
        exit()
else:
     if not hh in [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 23]:
        exit()
# Add your script here.

```

---

<div class="post-metadata">

**Author:** ![Vatsal\_Shah](https://avatars.discourse-cdn.com/v4/letter/v/0ea827/32.png) [@Vatsal\_Shah](https://forum.inductiveautomation.com/u/Vatsal_Shah)\
**Post date:** [April 11, 2024, 11:16am UTC](https://forum.inductiveautomation.com/t/gateway-event-script-schedule/88684/3 "2024-04-11T11:16:11Z")

</div>

Didn't get the Second approach. Request to explain a bit more

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [April 11, 2024, 11:19am UTC](https://forum.inductiveautomation.com/t/gateway-event-script-schedule/88684/4 "2024-04-11T11:19:29Z")

</div>

Do you understand how to run the script every 30 minutes useing Project Browser | Scripting | Gateway Events | Scheduled?

The script is added on the Scheduled Script | Script tab.

Do you understand the script itself? If not where are you stuck?

---

<div class="post-metadata">

**Author:** ![Vatsal\_Shah](https://avatars.discourse-cdn.com/v4/letter/v/0ea827/32.png) [@Vatsal\_Shah](https://forum.inductiveautomation.com/u/Vatsal_Shah)\
**Post date:** [April 11, 2024, 11:35am UTC](https://forum.inductiveautomation.com/t/gateway-event-script-schedule/88684/5 "2024-04-11T11:35:10Z")

</div>

Got it everything now.  
Thanks

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [April 11, 2024, 11:40am UTC](https://forum.inductiveautomation.com/t/gateway-event-script-schedule/88684/6 "2024-04-11T11:40:20Z")

</div>

Good. Try it out. If it works then mark post #2 as "Solution". Thanks.

---

<div class="post-metadata">

**Author:** ![Vatsal\_Shah](https://avatars.discourse-cdn.com/v4/letter/v/0ea827/32.png) [@Vatsal\_Shah](https://forum.inductiveautomation.com/u/Vatsal_Shah)\
**Post date:** [April 11, 2024, 12:12pm UTC](https://forum.inductiveautomation.com/t/gateway-event-script-schedule/88684/7 "2024-04-11T12:12:45Z")

</div>

Sure
