Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

The following may work:

Run dbus-monitor before you mount the USB and see what events it generates when the USB is mounted.

Then do something like this How do I run a script on a dbus signal?

share|improve this answer
    
I'll let you know when I have time to try this out ... –  Reinier Post Feb 21 at 9:24
    
This is more what he was looking for... danplanet.com/blog/2007/11/11/… –  hbdgaf Sep 27 at 7:26

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.