I have a Raspberry pi b with an SD card reader connected to one of the USB ports. I would like to automatically process files as soon as an SD is inserted. Is there a way to somehow register a program to execute when a new USB disk is detected?
I basically want to use the RPI as a smart SD reader, so the SD reader will be fixed on the one USB port. And I want IoT like behavior with no user interaction ( other than inserting the SD ).
I am trying to avoid an infinite loop checking when one of the /media/usb? directories become valid.
I am new at RPI and not a low lever Linux guy, so any direction will help. Thanks,
/media(I generally find this annoying, and disable withfstabentries), this does not happen on the command line. I assume this uses theudevDynamic device management rules to achieve this. You could establish udev rules to perform a specific action. – Milliways Jan 03 '16 at 11:27udevadm monitor --udev --propertyas soon as I can. In particular, I want to understand if removing the SD card itself will trigger an event, or only when I remove the card reader. But +1 on your comment – dkarchmer Jan 06 '16 at 00:17