views:

22

answers:

2

I wanted to know how to run a script after a usb pen drive is inserted and auto-mounted Till know i am able to run a script as soon as the device is inserted, however the mounting of the device takes place after the shell script action has ended

A: 

You'll have to listen for the appropriate D-Bus signals notifying that the volume has been mounted.

Ignacio Vazquez-Abrams
A: 

You can write udev rules in /etc/udev/rules.d/ and use the RUN like :

KERNEL=="sd?1",ATTRS{serial}=="001CC27F",ACTION=="add",RUN+="/path/to/script.sh'"

note : script.sh will be run with root privileges.

N 1.1