[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: UDEV to trigger a program



Hi,

> I would to know how to use/modify UDEV (with Linux 2.6.18-6-686) in order to
> execute a wanted program (that I programmed myself) when I plug a USB key to
> the PC.

i casually was reading this thread:
http://ubuntuforums.org/archive/index.php/t-262696.html
where is explained something like you are looking for (i quote the
specific post):

"
1. Plug your device and mount it usually. Then call
udevinfo -a -p /sys/block/sda --> you have insert your devices sd*
here. You are doing this to get some information about your drive to
identify it in a rule file.

2. put your rules file under /etc/udev/rules.d/ with a name like 10-local.rules

3. your rule file should be like

KERNEL=="sd*",SYSFS{size}=="308206223",SYMLINK+="mydisk",RUN="your_script"

this will create a symbolic link for your device and run your script
to mount it. since you named it as mydisk* and not some random sdb5 or
stuff, your script will be able to correctly identify it.
"

Hope this helps you!
Regards
M


Reply to: