execute script after (auto)mounting external device

Fred Roller froller at tnclimited.com
Tue Dec 8 14:01:52 UTC 2009


Patrick Drechsler wrote:
> 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
>
>
>   
Congrads!  Glad you figured it out.  This helped refresh my memory and 
learned a little more as well.  Thanks for posting results and progress.

-- 
Fred
www.fwrgallery.com

"Life is like linux, simple.  If you are fighting it you are doing something wrong."





More information about the ubuntu-users mailing list