# Before and after deployment hooks

**URL:** <https://hub.mender.io/t/before-and-after-deployment-hooks/604>\
**Category:** General Discussions\
**Created:** [May 22, 2019, 10:16am UTC](https://hub.mender.io/t/before-and-after-deployment-hooks/604 "2019-05-22T10:16:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tmrskos](https://avatars.discourse-cdn.com/v4/letter/t/c68b51/32.png) [@tmrskos](https://hub.mender.io/u/tmrskos)\
**Post date:** [May 22, 2019, 10:16am UTC](https://hub.mender.io/t/before-and-after-deployment-hooks/604/1 "2019-05-22T10:16:49Z")

</div>

Hi all,

Admittedly new here (first post) and to Mender. I had a few questions I was unable to find answers to and hoping for a little guidance. I’m using Mender 2.0 + Pi 3b + Debian Stretch, running a hosted Mender PoC. I searched the forum already, but was unable to locate answers.

1. When provisioning a new Raspberry Pi image, it it possible to run commands on the device before the new image is downloaded and swapped? The thought was to write some things to persistent storage before a new image is applied (i.e. current state configuration file).

2. Is there an easy way to take my running image out of demo mode so it checks for update more frequently? When I deploy a new image, I think it’s taking 30 minutes to poll the server for a new deployment. Wonder if theres a setting or command I can run on an already baked images to force a poll prematurely.

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:** [May 22, 2019, 12:17pm UTC](https://hub.mender.io/t/before-and-after-deployment-hooks/604/2 "2019-05-22T12:17:55Z")

</div>

Hi @tmrskos,

> When provisioning a new Raspberry Pi image, it it possible to run commands on the device before the new image is downloaded and swapped? The thought was to write some things to persistent storage before a new image is applied (i.e. current state configuration file).

For this you can use state-scripts,

[https://docs.mender.io/2.0/artifacts/state-scripts](https://docs.mender.io/2.0/artifacts/state-scripts)

> Is there an easy way to take my running image out of demo mode so it checks for update more frequently? When I deploy a new image, I think it’s taking 30 minutes to poll the server for a new deployment. Wonder if theres a setting or command I can run on an already baked images to force a poll prematurely.

I am assuming that you are using `mender-convert` for which you can use the `--demo` flag to enable more frequent polling.

Otherwise you can modify `/etc/mender/mender.conf` and specifically this parameter,

```
 "UpdatePollIntervalSeconds": 1800

```

---

<div class="post-metadata">

**Author:** ![tmrskos](https://avatars.discourse-cdn.com/v4/letter/t/c68b51/32.png) [@tmrskos](https://hub.mender.io/u/tmrskos)\
**Post date:** [May 22, 2019, 3:27pm UTC](https://hub.mender.io/t/before-and-after-deployment-hooks/604/3 "2019-05-22T15:27:19Z")

</div>

This is what I was looking for, thanks for the information.
