# Tracking states of Mender Client

**URL:** https://hub.mender.io/t/tracking-states-of-mender-client/2941
**Category:** General Discussions
**Tags:** raspberry-pi-zero-wifi
**Created:** [December 5, 2020, 12:11am UTC](https://hub.mender.io/t/tracking-states-of-mender-client/2941 "2020-12-05T00:11:09Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![martind](https://avatars.discourse-cdn.com/v4/letter/m/ccd318/32.png) [@martind](https://hub.mender.io/u/martind)
#### Post date: [December 5, 2020, 12:11am UTC](https://hub.mender.io/t/tracking-states-of-mender-client/2941/1 "2020-12-05T00:11:09Z")

</div>

Hi,

I’m using hosted mender and my software updates are using the directory module. My application is a system service running python scripts running on a headless RPi. The application is responsible for enabling and connecting a cellular modem and then powering down the device (sudo shutdown) to save power. In the field this process could take 20 seconds once the cellular modem connects i.e. from starting to transfer data to shutting down the connection. I would like to keep track of the mender-client state so my main application can:

1. I leave the cell modem on long enough for mender-client to check the server
2. After the update has been successfully applied the application can perform a graceful shutdown

I am aware of this thread and it seems that best practice is to use state scripts to pipe states to a file. Since the discussion was about standalone mender I just wanted to ask if there was anything built into the mender-client running in hosted mode i.e. Dbus, etc.

> [@Mender 2.0 - How to get the update progress from standalone mender?](https://hub.mender.io/t/mender-2-0-how-to-get-the-update-progress-from-standalone-mender/768):
>
> Hi, I understood that, the mender have logs and we can pipe/grep the logs to get the required data. But, this is not something recommended to use in our project zipper_mouth_face Hence, I would like to know, how to get the update progress from mender client in standalone mode? Whether I can get the progress via a state script? Should I edit the mender client source to get the progress directly to a file (or some global variable which can pass the progress data to C application)? Apart from…

If I was to use state scripts to pipe mender-client status to a file is there any status that are passed to the scripts when they are called i.e. some values representing Idle, Artificat Commit, etc.

Thanks,

---

<div class="post-metadata">

### Author: ![mirzak](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/mirzak/32/2056_2.png) [@mirzak](https://hub.mender.io/u/mirzak)
#### Post date: [December 8, 2020, 7:24am UTC](https://hub.mender.io/t/tracking-states-of-mender-client/2941/2 "2020-12-08T07:24:27Z")

</div>

> Since the discussion was about standalone mender I just wanted to ask if there was anything built into the mender-client running in hosted mode i.e. Dbus, etc.

It is the same mechanism when running in managed mode (hosted mode). More information on state-scripts can be found here:

[https://docs.mender.io/artifact-creation/state-scripts](https://docs.mender.io/artifact-creation/state-scripts)

> If I was to use state scripts to pipe mender-client status to a file is there any status that are passed to the scripts when they are called i.e. some values representing Idle, Artificat Commit, etc.

There is no in going information provided to state-scripts, but as you create scripts representing states, indirectly you will know which state you are running.

---

<div class="post-metadata">

### Author: ![martind](https://avatars.discourse-cdn.com/v4/letter/m/ccd318/32.png) [@martind](https://hub.mender.io/u/martind)
#### Post date: [December 9, 2020, 12:29am UTC](https://hub.mender.io/t/tracking-states-of-mender-client/2941/3 "2020-12-09T00:29:01Z")

</div>

> [@mirzak](#):
>
> f I was to use state scripts to pipe mender-client status to a file is there any status that are passed to the scripts when they are called i.e. some values representing Idle, Artificat Commit, etc.

Thanks for the explanation @mirzak
