Run script on USB thumb drive connection

Bill Moseley moseley at hank.org
Mon Feb 16 22:08:53 UTC 2009


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?

Thanks,



-- 
Bill Moseley
moseley at hank.org
Sent from my iMutt





More information about the ubuntu-users mailing list