State scripts not running in Debian

I’m fairly new to Mender and I’m trying out state scripts. As a tryout, I created two state scripts, names Idle_Enter and Idle_Leave in /etc/mender/scripts/. The scripts are very simple:

#!/bin/sh
touch /var/lib/mender/idle-enter-hit
exit 0

However, I see no file being created in /var/lib/mender/, not after a reboot, not after restarting mender-updated, not after creating and finishing a small deployment.

My setup is a raspi with Debian Trixie 64 bit. From what I understood, Idle_ scripts can be generated in the file system, where Artifact scripts need to be included in the artifact. So what am I doing wrong?

Hi @Michiel,

Thanks for reaching out! The reason is probably the missing ordering number in the filenames. The Mender Client expects this pattern:

<STATE_NAME>_<ACTION>_<ORDERING_NUMBER>_<OPTIONAL_DESCRIPTION>

as documented at State scripts | Mender documentation, so probably renaming the scripts to Idle_Enter_00 and Idle_Leave_00 does the trick.

Besides that, make sure that the execute flag is set on them.

Greetz,
Josef

Check, I didn’t know the order number was mandatory if you only had a single script. That fixed it, thanks.