How can I trigger a script to be run when an always connected drive is mounted?
I have tried udev
, specifically placing a rule 99-local.rules
in /etc/udev/rules.d
:
KERNEL=="mmcblk0",ACTION=="mount",RUN+="/path/to/script.sh"
And reloading the rules. But the script does not run when the drive is mounted.
Note that the drive is an SD card, hence the mmcblk0
block device name. It is not a USB drive and is not being hotplugged.
/media/yr-username/yr-mmcbki0-tag
Confirm or correct me if I am wrong by checking whether yr sd card is mounted or not under/media./...
. Runmount -l | grep mmcblk0
and post result. Depending on yr response I may have a working solution tomorrow.udev
in this particular case. Detail in answer.