You can test if your rule will be hit or not by running
udevadm test /path/to/sysfs/dev
You can find the devices sysfs node by using this:
udevadm info -q path -n /dev/sda #To find sysfs node for first HDD
So to wrap that all together it'll be:
udevadm test $(udevadm info -q path -n /dev/sda) 2>&1 | more
Grep that for your script's name or read it line by line if you want. If your script is called but isn't executing then remember you don't have a typical environment in a udev script and so you must call all programs by their full path or otherwise recreate the environment to your liking. Try replacing adb
and chromium-browser
with their absolute paths (which adb
and which chromium-browser
)
Also the second exec
in your bash script wont execute like you expect as the environment doesn't specify a window system for Chromium to launch in. I think I understand what you were trying to do here, but udev is designed to be non-interactive.
In response to your comment. There are a few abstract screens on every unix system referred to as displays. X11, which is the window manager (think explorer.exe, sort of)
for Ubuntu occupies one of them (7 or 8 I think, I work via ssh mostly). When you run a graphical program from the command line (say gedit) it will check the DISPLAY
environment variable to determine which display it will draw itself on.
There's more to it that this, and I've never personally gotten a firm understanding of what the 'other stuff' is going on back there, but I'd try to do a few diagnostic things from your script:
mkdir /tmp/udev-script
/usr/bin/printenv > /tmp/udev-script/environment.log
/bin/echo "My script was run!" > /tmp/udev-script/script.log
DISPLAY=:8 # or :7, play around with that
export DISPLAY # Promote shell variable to environment variable
exec /path/to/chromium 2> /tmp/udev-script/chromium.log 1>&2 &
exit # This is important for udev, see sources
source1(udev)
source2(man udevadm)
source3(EXEC)
source4(DISPLAY)