Using mender client as a trigger or a signal to execute a script

I am currently working on a IoT gateway project that requires mender to do an OS update. The mender client is successfully installed and running on the gateway. What I want to do is run a custom script that will be triggered when mender client starts the OS update process when initiated from the dashboard.
The sequence of actions could be something as follows:
1.Deploy the OS update from mender dashboard
2.Mender client communicates with mender server and checks that an OS update has been triggered.(this is my assumption of how it would run)
3. Once mender client starts downloading the OS update artifact from mender server, it can trigger my custom script to run.

Is this possible to do on the gateway system? Are there any configuration or script files that are automatically run by mender client that I can modify such that while executing, it also calls my script to run?

Any inputs to this would be very helpful!

Hi @Utsav_Shah,

The state scripts can do exactly that. For the given description, you probably want to use the Download state. More details in the documentation at State scripts | Mender documentation

Greets,
Josef

Understood! Thank you for the info.
I am currently running mender client on a Ubuntu server version 20.04. As per the document, it says that you can find scripts for Download state in /etc/mender/scripts.

In my system I could not find any scripts for the download state :
image

Is there any other location where I can find those scripts?