Run script on USB thumb drive connection

Dotan Cohen dotancohen at gmail.com
Mon Feb 16 22:11:45 UTC 2009


2009/2/17 Bill Moseley <moseley at hank.org>:
> Hotplug, udev, hal, or gnome-volume-manger?
>
>
> When I plug in a USB drive a Nautilus window opens automatically.
> For a specific usb drive I instead want a script to run (to run
> rsync).
>
> I can add a udev rule:
>
> KERNEL=="sd?1", ATTRS{serial}=="SNDK4CC844257C401401", ACTION=="add", \
>       SYMLINK+="backup", \
>       RUN+="/home/bill/backup.sh"
>
> and that script will run, but it seems to happen before the drive is
> mounted.  I thought maybe I needed to work with gnome-volume-manger
> but that doesn't seem to be used in Intrepid.
>
> So, I'm a bit confused how the parts fit together.
>
> What I want is to have the drive mounted like it normally is, then run
> a script and then umount the drive.  And for a bonus pop-up a window
> to DISPLAY 0:0 saying the rsync was complete.
>
> Seems pretty basic.
>
> Anyone done this?
>

I've not tried it, but have the script wait a bit:
sleep 10

-- 
Dotan Cohen

http://what-is-what.com
http://gibberish.co.il

א-ב-ג-ד-ה-ו-ז-ח-ט-י-ך-כ-ל-ם-מ-ן-נ-ס-ע-ף-פ-ץ-צ-ק-ר-ש-ת
ا-ب-ت-ث-ج-ح-خ-د-ذ-ر-ز-س-ش-ص-ض-ط-ظ-ع-غ-ف-ق-ك-ل-م-ن-ه‍-و-ي
А-Б-В-Г-Д-Е-Ё-Ж-З-И-Й-К-Л-М-Н-О-П-Р-С-Т-У-Ф-Х-Ц-Ч-Ш-Щ-Ъ-Ы-Ь-Э-Ю-Я
а-б-в-г-д-е-ё-ж-з-и-й-к-л-м-н-о-п-р-с-т-у-ф-х-ц-ч-ш-щ-ъ-ы-ь-э-ю-я
ä-ö-ü-ß-Ä-Ö-Ü


More information about the ubuntu-users mailing list