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
Asked
Active
Viewed 3,094 times
2 Answers
2
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
- 12,418
- 6
- 43
- 61
0
You'll have to listen for the appropriate D-Bus signals notifying that the volume has been mounted.

Ignacio Vazquez-Abrams
- 776,304
- 153
- 1,341
- 1,358