El 15/10/12 18:03, Nicolás Reynolds escribió:
Quiliro Ordóñez<[email protected]> writes:
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:
devmon --exec-on-drive "cp -r /home/quiliro/media %d ; umount %d"
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:
devmon --exec-on-drive "cp -r %d/media /home/quiliro/ ; umount %d"
I understand that can be done by adding a udev rule. I found the
specifications of the ports by using:
udevadm info -a -p $(udevadm info -q path -n /dev/sdb1)
after plugging in any USB memory to both ports:
KERNELS=="2-1" for the right USB port
KERNELS=="2-2" for the left USB port
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.
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:
devmon --exec-on-device /dev/right_USB "cp -r /home/quiliro/media %d ;
umount %d"
devmon --exec-on-device /dev/right_USB "cp -r %d/media /home/quiliro/ ;
umount %d"
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.
wouldn't it be more simple/easier to do both things at the same time,
for instance:
devmon --exec-on-device /dev/usb "rsync -a %d/ /home/quiliro/; rsync -a
/home/quiliro/ %d/ ; umount %d"
will synchronize usb to the sharing device and back, then umount :D
That won't work. It should upload from USB memory on one port and
download to USB memory on the other port. It should not upload on the
download port or download on the upload port.
--
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)
_______________________________________________
Dev mailing list
[email protected]
https://lists.parabolagnulinux.org/mailman/listinfo/dev