This question already has an answer here:
After getting my 3g-modem to work in
Arch Linux I wanted to eliminate some manual labour required in the process. Hence I needed to create an udev rule. After some trial and error I came up with the following rule named
11-my-rule.rules which I placed at
# start at sdb to ignore the system hard drive KERNEL!="sd[b-z]*", GOTO="my_media_automount_end" # run the script and create a testdir to verify the rule works ACTION=="add", RUN+="/myscript.sh", RUN+="/bin/mkdir -p '/media/pendrive'" #remove the testfolder on removal of usb ACTION=="remove", RUN+="/bin/rm -R '/media/pendrive'" # exit LABEL="my_media_automount_end"
My testscript which is meant to be ran is as follows:
#!/bin/bash DISPLAY=:0 xterm
Which displays xterminal. I have tested the script itself and it works. Also the second RUN+ that creates the test-directory works as well. Hence I am at a loss just what am I doing wrong.