# Run Script at Specific Times?

**URL:** <https://forum.inductiveautomation.com/t/run-script-at-specific-times/12508>\
**Category:** Ignition\
**Created:** [January 3, 2017, 2:58pm UTC](https://forum.inductiveautomation.com/t/run-script-at-specific-times/12508 "2017-01-03T14:58:06Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![ajdewhirst](https://avatars.discourse-cdn.com/v4/letter/a/f05b48/32.png) [@ajdewhirst](https://forum.inductiveautomation.com/u/ajdewhirst)\
**Post date:** [January 3, 2017, 2:58pm UTC](https://forum.inductiveautomation.com/t/run-script-at-specific-times/12508/1 "2017-01-03T14:58:06Z")

</div>

I would like to be able to trigger a script to run at specific times e.g. on the hour or at 15, 30, 45 and 0 minutes past the hour, or once a day at 0900. I’d like the trigger to run indefinitely until disabled.

I can see there are Timer scripts within Ignition, but the timing of these is rate based, which does not guarantee the absolute time at which the script will execute.  
Is there a way to execute scripts at a specific time within Ignition, or a way to trigger externally with (for example) Windows Task Scheduler? Thanks.

---

<div class="post-metadata">

**Author:** ![Pat](https://avatars.discourse-cdn.com/v4/letter/p/8491ac/32.png) [@Pat](https://forum.inductiveautomation.com/u/Pat)\
**Post date:** [January 3, 2017, 3:44pm UTC](https://forum.inductiveautomation.com/t/run-script-at-specific-times/12508/2 "2017-01-03T15:44:41Z")

</div>

You could put this in a Gateway Timer script that executes every 1000ms

[code]from time import localtime, strftime

curTime = strftime("%H:%M:%S", localtime())

if curTime == “00:00:01”:  
yourScript()

if curTime == “06:00:00”:  
yourScript2()[/code]

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [January 3, 2017, 3:49pm UTC](https://forum.inductiveautomation.com/t/run-script-at-specific-times/12508/3 "2017-01-03T15:49:27Z")

</div>

Hi!

Other things you can try:

Option 1  
You can create an expression tag, with the expression tailor made for your trigger. For example, this will be true at 0, 15, 30, and 45 minutes of the hour:

```auto
(getMinute(now())) = 0 ||
(getMinute(now())) = 15 ||
(getMinute(now())) = 30 ||
(getMinute(now())) = 45

```

Then, in the Tag Events section, use a Value Changed script:

 ![2019-07-25_13-35-39](https://us1.discourse-cdn.com/inductiveautomation/original/2X/e/e1e705b499e292f5ad772244c1700ba9b0d9c648.jpeg)

Option 2  
Same expression tag, but use it in a Gateway Tag Change Script

 ![2019-07-25_13-36-33](https://us1.discourse-cdn.com/inductiveautomation/original/2X/4/46e1c7b783b8e7728e441b8cc1595ec504332714.jpeg)

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [January 3, 2017, 3:54pm UTC](https://forum.inductiveautomation.com/t/run-script-at-specific-times/12508/4 "2017-01-03T15:54:01Z")

</div>

One thing to keep in mind (because I’ve been bitten by it once or twice) is that while Gateway Event Scripts run on the gateway, the script is stored with the project. So if you have multiple projects, you’ll need to pay attention to which project you put it in.

Or, in Leo Beiser’s First Computer Axiom, “When putting it into memory, remember where you put it.”

---

<div class="post-metadata">

**Author:** ![ajdewhirst](https://avatars.discourse-cdn.com/v4/letter/a/f05b48/32.png) [@ajdewhirst](https://forum.inductiveautomation.com/u/ajdewhirst)\
**Post date:** [January 4, 2017, 4:56pm UTC](https://forum.inductiveautomation.com/t/run-script-at-specific-times/12508/5 "2017-01-04T16:56:14Z")

</div>

Thanks for the suggestions!

---

<div class="post-metadata">

**Author:** ![adam.todorski](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/adam.todorski/32/19388_2.png) [@adam.todorski](https://forum.inductiveautomation.com/u/adam.todorski)\
**Post date:** [July 25, 2019, 4:33pm UTC](https://forum.inductiveautomation.com/t/run-script-at-specific-times/12508/6 "2019-07-25T16:33:54Z")

</div>

Would it be possible to re-post the images so that they display here?

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [July 25, 2019, 5:37pm UTC](https://forum.inductiveautomation.com/t/run-script-at-specific-times/12508/7 "2019-07-25T17:37:52Z")

</div>

Done. 🙂

---

<div class="post-metadata">

**Author:** ![ken.maze](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ken.maze/32/85876_2.png) [@ken.maze](https://forum.inductiveautomation.com/u/ken.maze)\
**Post date:** [January 20, 2024, 5:50am UTC](https://forum.inductiveautomation.com/t/run-script-at-specific-times/12508/8 "2024-01-20T05:50:32Z")

</div>

I know this is old, but in case somebody has the question and comes across this, as of version **8.1.6** there is a Gateway Event Scheduled Timer, which is absolute. It has a nice interface and shows you the equivalent unix crontab settings as you set it up.
