Is there a way to run a script when a specific USB device is mounted?
I keep my videos on a separate USB and would like to run a script that would mount the video folder on the USB device to the one in the home folder.
|
|
|
Start by finding your device in Create a new udev rules file in
Note how I used the ID from Then you just need to write the script to do the work. A simple mount command should work. You might need a Addition from Allan: Long running scripts might block "all further events for this or a dependent device". My Mint man page further states "Long running tasks need to be immediately detached from the event process itself." No tip is given on where to gain the skill to do this. |
|||||||||
|
|
Another way to get the values for ATTRS{idVendor} and ATTRS{idProduct} (tested in Ubuntu 12.04) is:
|
|||
|
|
|
|
|||||
|
|
In Nautilus under Edit>Preferences>Media you can choose "other action" and than "costum command". for different kind of media to be executed. By that time the usb drive is already mounted, but I suppose you could still link it (with a costum command) to the folder you want the drive to appear in. I couldn't tell whether this is easier or better than using udev. |
|||
|
|