Hey jOOc, thanks for the great reply. You helped to remind me to take baby steps when things aren't working.
Short story, I got my script working with the UDEV rule - sweet. I mimicked your test script, which worked, and traced the problem back to an obscure issue with Zenity which I am using to generate a dialog box from my script. Since Zenity wasn't being called from a terminal window it had no point of reference for where to open the dialog box and crashed out the script, so it needed a display explicitly stated. In case anybody needs the Zenity solution, here it is:
Code: Select all
export DISPLAY=:0.0; zenity --question --title="Auto Disc Ripper" --text="Allow automatic disc rip?" --timeout=15
HOWEVER! I encountered a second, smaller problem. My script was being launched whenever a disc is mounted AND ejected. By using the udevadm tool command 'udevadm info --query=all --path=/sys/block/sr0' to get information about the drive while a disc was present and not present I was able to figure an addition to my rule that fixed the problem.
Code: Select all
SUBSYSTEM=="block", KERNEL=="sr0", ENV{DKD_MEDIA_AVAIABLE}=="1", RUN+="/usr/local/bin/detectdisc"
The only caveat is that the rule name had to be changed to from "10-my.rule" to "99-my.rule".