I need to automatically copy images off a camera when it is inserted into the USB port. I've written a script to do the copying, and I've found that, by creating a file
/etc/udev/rules.d/95-my-own.rules
with the line
ACTION=="add", KERNEL=="sdg1", RUN+="/path/to/my/script"
I can invoke the script when a USB device (such as the camera) is inserted.
The script is invoked at a time when the disk hasn't been mounted yet.
My workaround is to make the script start the copying process in the background after some sleep
to give it time for the file system to be mounted, but it would be better to trigger the script right after the file system has been mounted.
How?