0

I want my usb to run a command or a script --like autorun-- when it is plugged in. I've also searching and found out that autorun was not present because of some security reason(s). How do you run a command after a specific type of USB is plugged in ?

marked as duplicate by Radu Rădeanu, Jorge Castro, gertvdijk, Basharat Sialvi, Eric Carvalho Jul 1 '13 at 2:10

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

3

Place your script in /usr/local/bin (otherwise this sometimes refuses to work). Then create file /etc/udev/rules.d/99-usb.rules. In it, place the line like

ACTION=="add", SUBSYSTEM=="block", KERNEL=="sd[a-z]1", ATTRS{vendor}=="SanDisk ", RUN+="/usr/local/bin/backup.sh"

Adapt to your needs. Generally, it works, but , however, i've never tried it on Ubuntu.

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