# Initiate updates in managed mode

**URL:** <https://hub.mender.io/t/initiate-updates-in-managed-mode/1552>\
**Category:** General Discussions\
**Created:** [February 18, 2020, 12:49am UTC](https://hub.mender.io/t/initiate-updates-in-managed-mode/1552 "2020-02-18T00:49:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tloten](https://avatars.discourse-cdn.com/v4/letter/t/258eb7/32.png) [@tloten](https://hub.mender.io/u/tloten)\
**Post date:** [February 18, 2020, 12:49am UTC](https://hub.mender.io/t/initiate-updates-in-managed-mode/1552/1 "2020-02-18T00:49:56Z")

</div>

Hi. I have a few questions about managed mode:

1. Is there any way to determine what the managed daemon is currently doing? E.g. To see if it’s currently downloading a new artifact?
2. While the systemd Mender service is running, is it OK to also call the mender binary in standalone mode? E.g. calling ‘mender -check-update’ explicitly. Could this potentially interfere with an already ongoing download by the managed daemon?
3. Assuming (2) is OK, if I call ‘mender -check-update’, will the daemon automatically detect the result of this, and proceed with downloading, installing & rebooting? Or will I need to wait for the normal check every ‘Update-Poll-Interval’?

For some context, our devices are powered on/off periodically by an external microcontroller in order to preserve power. They are generally only on for a minute or two before being powered off for between 10minutes - 24 hrs+.  
My initial plan is to

1. Power device on, perform usual device actions.
2. Check for an update via the Mender Client API
3. If update is available:  
3.1) Send message to external microcontroller to request that power not be shut off for 10 minutes or so.  
3.2) Initiate update (via mender -check-update)  
3.3) Wait. Presumably the managed daemon will download the update, install & reboot?
4. If no update available, shutdown.

Any feedback or suggestions are appreciated. Thanks!

---

<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:** [February 18, 2020, 7:48am UTC](https://hub.mender.io/t/initiate-updates-in-managed-mode/1552/2 "2020-02-18T07:48:21Z")

</div>

> [@tloten](#):
>
> Is there any way to determine what the managed daemon is currently doing? E.g. To see if it’s currently downloading a new artifact?

You can use a [`Download` state script](https://docs.mender.io/2.3/artifacts/state-scripts) to execute a script at the start and end of a Download.

> [@tloten](#):
>
> While the systemd Mender service is running, is it OK to also call the mender binary in standalone mode? E.g. calling ‘mender -check-update’ explicitly. Could this potentially interfere with an already ongoing download by the managed daemon?

Yes, this is fine. Signals intercepted while an update is in progress will just be ignored.

> [@tloten](#):
>
> Assuming (2) is OK, if I call ‘mender -check-update’, will the daemon automatically detect the result of this, and proceed with downloading, installing & rebooting? Or will I need to wait for the normal check every ‘Update-Poll-Interval’?

That should work, and is indeed the intended use case of `mender -check-update`.

---

<div class="post-metadata">

**Author:** ![tloten](https://avatars.discourse-cdn.com/v4/letter/t/258eb7/32.png) [@tloten](https://hub.mender.io/u/tloten)\
**Post date:** [February 19, 2020, 8:16pm UTC](https://hub.mender.io/t/initiate-updates-in-managed-mode/1552/3 "2020-02-19T20:16:49Z")

</div>

Perfect, looks like `mender -check-update` and an Enter-Download state script will do exactly what I need. Thank you.
