# State scripting for Raspberry PI board running ubuntu 18.04

**URL:** <https://hub.mender.io/t/state-scripting-for-raspberry-pi-board-running-ubuntu-18-04/1203>\
**Category:** General Discussions\
**Tags:** state-scripts\
**Created:** [October 30, 2019, 5:38am UTC](https://hub.mender.io/t/state-scripting-for-raspberry-pi-board-running-ubuntu-18-04/1203 "2019-10-30T05:38:09Z")\
**Posts on this page:** 1\
**Showing post:** 3

<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:** [October 30, 2019, 12:25pm UTC](https://hub.mender.io/t/state-scripting-for-raspberry-pi-board-running-ubuntu-18-04/1203/3 "2019-10-30T12:25:47Z")

</div>

> How to update a complete folder using mender

You can use the [Directory Update Module](https://hub.mender.io/t/directory/325) to deploy directory updates. There are usage instructions in that link. Note that you have to put the update module in the `/usr/share/mender/modules/v3` directory on the device before you can use them.

> I would like to run a custom shell script as soon as the mender updated the new file. How to do that in mender using state scripting, I have read about the state scripting documentation and I have basic idea about the naming convention and the folder structure. But I would like to get the procedure to run a script here.

Just specify `-s ArtifactInstall_Leave_50_myscript` when you make the artifact, and this script will execute after the install stage. You can replace `myscript` with whatever you want, and the contents can be whatever you want. If you use the artifact generation script for the Directory Update Module, then you can specify such options at the end, after a `--`. So for example:

```auto
./directory-artifact-gen -n ${ARTIFACT_NAME} -t ${DEVICE_TYPE} -d ${DEST_DIR} -o ${OUTPUT_PATH} ${FILE_TREE} -- -s ArtifactInstall_Leave_50_myscript

```

---

_[View the full topic](https://hub.mender.io/t/state-scripting-for-raspberry-pi-board-running-ubuntu-18-04/1203)._
