execute script after (auto)mounting external device

Patrick Drechsler patrick at pdrechsler.de
Mon Dec 7 19:01:59 UTC 2009


Tom H wrote:

> I have written rules without "ACTION=="add"". AFAIK "ACTION=="add"" is
> to add a device so unless the falsh drive is not auto-detected through
> the default udev rules, the OP should not need to prepend
> "ACTION=="add"" to his script running rule.
> 

ACTION=="add" (as opposed to ACTION=="remove") means that the action is 
only performed while adding the device. If no action is specified, the 
action will be performed while adding _and_ while removing the device.

 From http://reactivated.net/writing_udev_rules.html:
===============
You can also use the ACTION environment variable to detect whether the 
device is being connected or disconnected - ACTION will be either "add" 
or "remove" respectively.
===============


With all the help I received here I managed to run a script after 
plugging in my usb drive. So I'm halfway there. I just have to figure 
out how to detect if the encrypted partition is mounted. Currently I'm 
looking into mounttruecrypt 
(https://launchpad.net/~andreas-boettger/+archive/ppa).

Thanks, Patrick





More information about the ubuntu-users mailing list