execute script after (auto)mounting external device

stan stanb at panix.com
Mon Dec 7 19:52:36 UTC 2009


On Mon, Dec 07, 2009 at 08:08:27PM +0100, Patrick Drechsler wrote:
> Hi,
> 
> Currently I'm stuck with
> 
> =====================================
> ## /etc/udev/rules/70-myrules.rules
> ##
> # $ udevadm info -a -p $(udevadm info -q path -n /dev/mapper/truecrypt1)
> #
> # Udevadm info starts with the device specified by the devpath and then
> # walks up the chain of parent devices. It prints for every device
> # found, all possible attributes in the udev rules key format.
> # A rule to match, can be composed by the attributes of the device
> # and the attributes from one single parent device.
> #
> #   looking at device '/devices/virtual/block/dm-0':
> #     KERNEL=="dm-0"
> #     SUBSYSTEM=="block"
> #     DRIVER==""
> #     ATTR{range}=="1"
> #     ATTR{ext_range}=="1"
> #     ATTR{removable}=="0"
> #     ATTR{ro}=="0"
> #     ATTR{size}=="6290944"
> #     ATTR{alignment_offset}=="0"
> #     ATTR{capability}=="10"
> #     ATTR{stat}=="    6521        0     7172     5870        1        0 
>         1        0        0       70     5870"
> #
> ACTION=="add", KERNEL=="dm-[0-9]*", SUBSYSTEM=="block", 
> ATTR{size}=="6290944", \
> RUN+="/usr/bin/touch /home/patrick/test_$(bin/date +%F-%H%M%S).txt"
> =====================================
> 

I am not the expert on this, but I would expect that you would nee
/bin/touch, rather than bin/touch

-- 
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?




More information about the ubuntu-users mailing list