execute script after (auto)mounting external device

Patrick Drechsler patrick at pdrechsler.de
Mon Dec 7 21:02:07 UTC 2009


stan wrote:
>> 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

Outch! Thanks for the pointer! (s/touch/date/g)

I've simplified the rule (removing all bash/dash/sh substitutions).

------------------------------------------
## USB Stick: This works (file is touched during mount and unmount)
BUS=="usb", KERNEL=="sd?1", SYSFS{idVendor}=="090c", 
SYSFS{idProduct}=="1000", RUN+="/usr/bin/touch /home/patrick/testusb.txt"

## Truecrypt: This works
ACTION=="add", KERNEL=="dm-[0-9]*", SUBSYSTEM=="block", 
ATTR{size}=="6290944", RUN+="/usr/bin/touch /home/patrick/testcrypt.txt"
------------------------------------------

It works! Thanks so much for finding this typo Stan!

Problem is solved!

Cheers, Patrick





More information about the ubuntu-users mailing list