how to run a script when pen drive is inserted

Hi,

I need to run a script whenever a pen drive is connected to my ubuntu machine. The script is to be run from local disk and with privileges of current user. How do I achieve this?

Thanks.

you can use the concept of directory exist or not...

like when a pen drive will be connected to your system one specific directry will be mounted..

you can create one file watcher for the directory ... .ad run your specific job