# Startup script with infinite loop

**URL:** <https://forum.inductiveautomation.com/t/startup-script-with-infinite-loop/43493>\
**Category:** Ignition\
**Created:** [February 17, 2021, 1:37am UTC](https://forum.inductiveautomation.com/t/startup-script-with-infinite-loop/43493 "2021-02-17T01:37:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![calimero100582](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/calimero100582/32/18630_2.png) [@calimero100582](https://forum.inductiveautomation.com/u/calimero100582)\
**Post date:** [February 17, 2021, 1:37am UTC](https://forum.inductiveautomation.com/t/startup-script-with-infinite-loop/43493/1 "2021-02-17T01:37:49Z")

</div>

Is it possible to have an infinite loop in a startup script. We have a RabbitMQ (not MQTT yet) server which I can connect to with Python (and hopefully Jython, not tried it). The script imply an infinite loop which got me wondering if it would work as a startup script or it will break something.

Do all startup script run in parallel or sequential?  
Do the gateway wait the script to end in some way?  
Will the thread running the script will be restarted on changes to the script/project’s scripts?

---

<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 17, 2021, 2:13am UTC](https://forum.inductiveautomation.com/t/startup-script-with-infinite-loop/43493/2 "2021-02-17T02:13:06Z")

</div>

Infinite loops should always be placed in their own thread with system.util.invokeAsynchronous(), and include some form of self checking to let themselves be replaced when scripting restarts.

---

<div class="post-metadata">

**Author:** ![calimero100582](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/calimero100582/32/18630_2.png) [@calimero100582](https://forum.inductiveautomation.com/u/calimero100582)\
**Post date:** [February 17, 2021, 2:42am UTC](https://forum.inductiveautomation.com/t/startup-script-with-infinite-loop/43493/3 "2021-02-17T02:42:51Z")

</div>

Looks promising. Not sure of the self checking, but I will start and see
