I am trying to make mdadm call into a simple bash script which writes a message in the kernel log in case of a state change.
I am running on a VM (qemu). The VM is running debian 12.5, and kernel version 6.1.118.
The script is as follows,
# cat /tmp/test.sh
#!/bin/bash
echo "raid array status change" > /dev/kmsg
I have added the following to the mdadm config file
PROGRAM /tmp/test.sh
ARRAY /dev/md0 UUID=<UUID of md0>
But when I do the test, it says the md0 is being picked up, and the correct program option is being used, but nothing gets printed in dmesg
mdadm --monitor --test /dev/md0 -1
Note that when I manually run the script, it prints the message in kernel log.
My questions
- Does the above process of calling the program depend on the mail setting also? Because my mail config is not set.
- Any idea what could be wrong or missing?
/tmp/test.sh
or as, say,bash /tmp/test.sh
)? If the latter, is/tmp
mountednoexec
?bash /tmp/test.sh
. And I did try moving the script to/opt/
folder too, but there were no logs still.echo "raid array status change" > /dev/kmsg
(as root) do what you want?/tmp/test.sh
(as root) - specifically notbash /tmp/test.sh
- do what you want?