# Running mender-client on demand

**URL:** <https://hub.mender.io/t/running-mender-client-on-demand/2410>\
**Category:** General Discussions\
**Created:** [September 9, 2020, 7:58am UTC](https://hub.mender.io/t/running-mender-client-on-demand/2410 "2020-09-09T07:58:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![joeli](https://avatars.discourse-cdn.com/v4/letter/j/5e9695/32.png) [@joeli](https://hub.mender.io/u/joeli)\
**Post date:** [September 9, 2020, 7:58am UTC](https://hub.mender.io/t/running-mender-client-on-demand/2410/1 "2020-09-09T07:58:52Z")

</div>

Hi,

I am new to Mender and would like your opinion on our use-case. We have a system performing measurements, so we do not want the mender-client to run from time to time. On the other hand when we want to upgrade our unit we would like to use both the mender-client and server.

I plan to add one line to mender-client.service  
ConditionPathExists=/var/lib/mender/software\_change\_active\_flag

And when a software change is required do:  
Create the file software\_change\_active\_flag and start mender-client.service.

In a state script (ArtifactCommit\_Leave\_…) or when software change should be aborted do:  
Remove the file software\_change\_active\_flag and stop mender-client.service.

Is this a feasible solution or should I do this some other way?

Best regards,  
Jonny

---

<div class="post-metadata">

**Author:** ![drewmoseley](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/drewmoseley/32/47_2.png) [@drewmoseley](https://hub.mender.io/u/drewmoseley)\
**Post date:** [September 9, 2020, 2:09pm UTC](https://hub.mender.io/t/running-mender-client-on-demand/2410/2 "2020-09-09T14:09:36Z")

</div>

I don’t see anything wrong with this but it will require an out-of-band mechanism to know that the software change is required.

You could simplify it a bit by simply using a DownloadEnter state script set to retry until your software stack is ready for updates to occur. This would have the benefit of not doing anything if there is no artifact to download.

Drew

---

<div class="post-metadata">

**Author:** ![joeli](https://avatars.discourse-cdn.com/v4/letter/j/5e9695/32.png) [@joeli](https://hub.mender.io/u/joeli)\
**Post date:** [September 10, 2020, 6:14am UTC](https://hub.mender.io/t/running-mender-client-on-demand/2410/3 "2020-09-10T06:14:52Z")

</div>

Hi Drew,

thanks for the response. I will look into your suggestion and see which solution we prefer.

Jonny
