Hi there,
I am having problem to run state scripts. I tried to run a sample script from location /var/lib/mender/scripts. But when I deploy the update, the update would run well and the script would not run at all and be deleted immediately. How do I run the script ?
Herewith, I have attached the script I am trying to test, and the log file of the deployment from my device.
Hi
I will need a bit more information on what is going on, like the name of the script, and when you want it to run?
Is this embedded in an Artifact, or did you manually add it to the script directory yourself?
See: https://docs.mender.io/hosted/artifacts/state-scripts for further information
Actually, I want to apply a User Confirmation use case for my project. I tried the directory update as shown in State scripting for Raspberry PI board running ubuntu 18.04 and How to create state scripts with Mender using Raspberry Pi. Deployment would be successful but, the script wouldn’t run.
Is there specific way or location to save the script ?
The -s prefix wouldn’t run with directory-artifact-gen and I tried it by modifying the code from https://github.com/mendersoftware/mender/blob/master/support/modules-artifact-gen/directory-artifact-gen
by adding -s ~/Downloads/ArtifactInstall_Enter_01_User_Confirmation-v2.py , but that didn’t work too.
Hi
It looks to me like you’re not using the generator though, but mender-artifact itself, in which case the --
is not needed.
mendersoftware mender-artifact write module-image -T directory -s ArtifactInstall_Enter_01_User_Confirmation-v2.py -n foobar -t baz
mendersoftware mender-artifact read artifact.mender
Mender artifact:
Name: foobar
Format: mender
Version: 3
Signature: no signature
Compatible devices: '[baz]'
Provides group:
Depends on one of artifact(s): []
Depends on one of group(s): []
State scripts:
ArtifactInstall_Enter_01_User_Confirmation-v2.py
Updates:
0:
Type: directory
Provides: Nothing
Depends: Nothing
Metadata: Nothing
Files: None
works.
Hi there,
what is the mendersoftware there? is it smth to install separately ? Can you link me to something related to that ?
You need to remove the “–” before the script option. That tells mender-artifact to stop processing command line parameters. I honestly don’t know what it will do in that case.
Also, the script you posted above is bash but you are using a .py extension. I don’t know if that will cause an issue or not.
Drew