# ProjectManager Project start order?

**URL:** <https://forum.inductiveautomation.com/t/projectmanager-project-start-order/18497>\
**Category:** Ignition\
**Created:** [June 17, 2018, 2:08am UTC](https://forum.inductiveautomation.com/t/projectmanager-project-start-order/18497 "2018-06-17T02:08:41Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![cmisztur2](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmisztur2/32/4243_2.png) [@cmisztur2](https://forum.inductiveautomation.com/u/cmisztur2)\
**Post date:** [June 17, 2018, 2:08am UTC](https://forum.inductiveautomation.com/t/projectmanager-project-start-order/18497/1 "2018-06-17T02:08:41Z")

</div>

What order are projects started in when the Gateway restarts?  
I would like a specific project to start up before anything else.

/c

---

<div class="post-metadata">

**Author:** ![Kyle\_Chase](https://avatars.discourse-cdn.com/v4/letter/k/9de0a6/32.png) [@Kyle\_Chase](https://forum.inductiveautomation.com/u/Kyle_Chase)\
**Post date:** [June 17, 2018, 4:50am UTC](https://forum.inductiveautomation.com/t/projectmanager-project-start-order/18497/2 "2018-06-17T04:50:54Z")

</div>

My guess would be the order of the primary key in the projects table of the internal database. Or they are started in parallel. You could check by writing the project name and current time to a logger.

---

<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:** [June 18, 2018, 3:26pm UTC](https://forum.inductiveautomation.com/t/projectmanager-project-start-order/18497/3 "2018-06-18T15:26:40Z")

</div>

It appears (from a quick glance at the source) that they’re ordered by name.

---

<div class="post-metadata">

**Author:** ![cmisztur2](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmisztur2/32/4243_2.png) [@cmisztur2](https://forum.inductiveautomation.com/u/cmisztur2)\
**Post date:** [June 18, 2018, 7:24pm UTC](https://forum.inductiveautomation.com/t/projectmanager-project-start-order/18497/4 "2018-06-18T19:24:26Z")

</div>

It looks that way from the ProjectManager point of view, but then the order is different when looking at timing from Gateway startup scripts.

/c

---

<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:** [June 18, 2018, 7:33pm UTC](https://forum.inductiveautomation.com/t/projectmanager-project-start-order/18497/5 "2018-06-18T19:33:22Z")

</div>

The order the startup scripts are run is (effectively) non-deterministic.

---

<div class="post-metadata">

**Author:** ![cmisztur2](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmisztur2/32/4243_2.png) [@cmisztur2](https://forum.inductiveautomation.com/u/cmisztur2)\
**Post date:** [June 18, 2018, 7:40pm UTC](https://forum.inductiveautomation.com/t/projectmanager-project-start-order/18497/6 "2018-06-18T19:40:30Z")

</div>

Hmmm, OK.  
…

---

<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:** [June 18, 2018, 7:56pm UTC](https://forum.inductiveautomation.com/t/projectmanager-project-start-order/18497/7 "2018-06-18T19:56:11Z")

</div>

Place the code you want executed first in a shared script, at the top level (not in a function) so it will be executed on import of that script. Have all of your projects define a gateway startup script whose very first line calls an empty function in that shared script. Then it doesn’t matter which project starts first.

---

<div class="post-metadata">

**Author:** ![cmisztur2](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmisztur2/32/4243_2.png) [@cmisztur2](https://forum.inductiveautomation.com/u/cmisztur2)\
**Post date:** [June 18, 2018, 8:43pm UTC](https://forum.inductiveautomation.com/t/projectmanager-project-start-order/18497/8 "2018-06-18T20:43:02Z")

</div>

I used a Java Timer and TimerTask to delay.
