As a beginning, I successfully completed the single file update using mender in Raspberry PI board running with Ubuntu 18.04. Now I have another two things to do,
How to update a complete folder using mender ?
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.
Any help will be completely appreciable. As I am new to mender, wish to be part of this.
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:
I am getting an error like ./directory-artifact-gen: line 32: hash: mender-artifact: not found. But I downloaded the latest mender artifact binary and located in /usr/bin/ folder of my computer.
Tried to run a script as per your suggestion. I could able to sucesfully create an artifact with my custom script. But the update fails. Attached the screenshot of the failure. My script name is ArtifactInstall_Leave_50_myscript
I could able to execute the script manually from the server environment. If i make the artifact along with script, the new directory is not even updating in the device. Its an empty folder.
The script is a small shell script. The content of the script is only echo “Hello” for testing purpose.
And while naming the script file it should be only ArtifactInstall_Leave_50_myscript or ArtifactInstall_Leave_50_myscript.sh
Thank you very much
After changing to #!/bin/sh i could able to deploy the artifact without any error. But how can I verify that my script is running on the device. I am not able to see my script on the device actually
You cannot see it directly, because the script only exists while the update is being installed. But if the script leaves a trace somewhere (for example touch /tmp/script-was-here), you can look for it afterwards.