The Mender Client supports multiple ways to customize the update process:
The Mender Client can run pre- and post-install scripts, before and after it writes the root file system. However, Mender state scripts are more general and useful than pre/post-install scripts because they run between any state transition, not just (before/after) the install state.
Typical use cases are:
A State script can be run before (Enter) or after (Leave) each of the following states.
Most of the states also have an Error transition which runs if some error occurs while executing any script for the given state.
State scripts run as pre and post-scripts to every state in the Mender state machine shown above. The state in which a given script runs is determined by the script name and index.
Exit codes from a state script can control the execution of the Mender state machine. Depending on the return code from the script, the Mender client will:
The Mender client collects logs during an update. In case of a failure, these logs are sent to the Mender server. The output from state scripts are included in these logs. This is useful when troubleshooting intermittent update failures.
To learn more, have a look at the tutorial on how to implement State scripts.
When creating a software deployment, it is possible to control the update from the Mender UI or an application running locally on the device by telling the Mender client to wait at specific points in the deployment. The deployment can then either continue or rollback from this point at some later time.
See the screenshot below for an example of what is possible.
Common use cases are:
For more information on getting started with synchronized updates attributes, see How to use the Device-side API, or take a look at the Device-side API and Server-side API reference directly.
© 2024 Northern.tech AS