# Interaction between state scripts and Update Control Maps

**URL:** <https://hub.mender.io/t/interaction-between-state-scripts-and-update-control-maps/5102>\
**Category:** General Discussions\
**Created:** [July 8, 2022, 4:04pm UTC](https://hub.mender.io/t/interaction-between-state-scripts-and-update-control-maps/5102 "2022-07-08T16:04:29Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![kevlan](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/kevlan/32/695_2.png) [@kevlan](https://hub.mender.io/u/kevlan)\
**Post date:** [July 8, 2022, 4:04pm UTC](https://hub.mender.io/t/interaction-between-state-scripts-and-update-control-maps/5102/1 "2022-07-08T16:04:29Z")

</div>

I am reading over the information on the [Use the Device-side API | Mender documentation](https://docs.mender.io/client-installation/use-the-device-side-api) page and it is unclear what effect the Update Control Maps have on existing state scripts.

For background, we are trying to setup a system where the state scripts normally prevent an update from running while the product is on but we need a way for the user to force an update to run anyways. From the docs the following items are unclear:

- Should I be using continue or force\_continue? What is the difference between them?
- Will all the state scripts still be run?
- Is the output from the state scripts still checked to determine if the update can continue?

---

<div class="post-metadata">

**Author:** ![kacf](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/kacf/32/146_2.png) [@kacf](https://hub.mender.io/u/kacf)\
**Post date:** [July 11, 2022, 6:37am UTC](https://hub.mender.io/t/interaction-between-state-scripts-and-update-control-maps/5102/2 "2022-07-11T06:37:38Z")

</div>

I will answer out of order, since it will be clearer then.

> [@kevlan](#):
>
> - Will all the state scripts still be run?
> - Is the output from the state scripts still checked to determine if the update can continue?

Update Control Maps and State Scripts are completely independent, so the only way they can influence each other is indirectly, by controlling which will be [the next state](https://docs.mender.io/3.3/artifact-creation/state-scripts#the-nine-states) the client will go to. For any state where both State Scripts and Update Control are supported, the order will be `Update Control action -> State Script Enter -> Actual State -> State Script Leave`. However, at any point, either Update Control or State Scripts can fail and divert the client, sending it to a different state, so it’s possible only the first of those four will be reached.

> [@kevlan](#):
>
> - Should I be using continue or force\_continue? What is the difference between them?

`continue` and `force_continue` are only relevant in comparison to other Update Control Maps. `continue` will continue the update as long as there are no other Update Control Maps (for example from the server) which specify `pause` or `fail` (priority doesn’t matter). `force_continue` however, forces the update to continue _even_ if there is a map with lower priority which specifies `pause` or `fail`.

> [@kevlan](#):
>
> For background, we are trying to setup a system where the state scripts normally prevent an update from running while the product is on but we need a way for the user to force an update to run anyways.

I would consider a completely different solution: Set [`UpdatePollIntervalSeconds`](https://docs.mender.io/3.3/client-installation/configuration-file/configuration-options#updatepollintervalseconds) very high, and rely on `mender check-update` to trigger updates instead. This means the client will never check on its own, but it will check when the user triggers it.
