<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<span style="font-weight: normal;"><font size="2"><font
color="#204a87"></font></font></span><span style="font-weight:
bold;color: #204a87;"></span>I have successfully used devmon for
automatically mounting a USB memory, copying a directory to it and
then unmounting it. It works correctly as root user with the
following command:<br>
devmon --exec-on-drive "cp -r /home/quiliro/media %d ; umount %d"<br>
I would like devmon to do that on a specific USB port. On another
specific port, I would like to do the opposite copy operation:<br>
devmon --exec-on-drive "cp -r %d/media /home/quiliro/ ; umount %d"<br>
I understand that can be done by adding a udev rule. I found the
specifications of the ports by using:<br>
udevadm info -a -p $(udevadm info -q path -n /dev/sdb1)<br>
after plugging in any USB memory to both ports:<br>
KERNELS=="2-1" for the right USB port<br>
KERNELS=="2-2" for the left USB port <br>
The point is not to recognize a USB memory specific product id or
device id, but to recognize the specific port it was connected to.<br>
<br>
So I suppose I need to create a udev rule. I think I have to assign
a symlink to the USB memories connected to the left port and another
to the right port. Then, I should use these commands:<br>
devmon --exec-on-device /dev/right_USB "cp -r /home/quiliro/media %d
; umount %d"<br>
devmon --exec-on-device /dev/right_USB "cp -r %d/media
/home/quiliro/ ; umount %d"<br>
<br>
Please suggest the rule I should use and the appropiate devmon
command. If no one is able to answer this question, please guide me
to a udev rule forum. Thank you.<br>
<pre class="moz-signature" cols="72">--
Saludos libres,
Quiliro Ordóñez
Board Member
Free software FoundationLatiin America
Presidente
Asociación de Software Libre del Ecuador - ASLE
Av de la Prensa N58-219 y Cristóbal Vaca de Castro
Quito, Ecuador
(593)8-454 8078 (desactivado temporalmente por viaje)</pre>
</body>
</html>