State scripting for Raspberry PI board running ubuntu 18.04

How to update a complete folder using mender

You can use the Directory Update Module 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:

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