FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Ubuntu > Ubuntu User

 
 
LinkBack Thread Tools
 
Old 02-16-2009, 09:08 PM
Bill Moseley
 
Default Run script on USB thumb drive connection

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@hank.org
Sent from my iMutt


--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 02-16-2009, 09:11 PM
Dotan Cohen
 
Default Run script on USB thumb drive connection

2009/2/17 Bill Moseley <moseley@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

א-ב-ג-ד-ה-ו-ז-ח-ט-י-ך-כ-ל-ם-מ-ן-*-ס-ע-ף-פ-ץ-צ-ק-ר-ש-ת
ا-ب-ت-ث-ج-*-خ-د-ذ-ر-ز-س-ش-ص-ض-ط-ظ-ع-غ-ف-ق-ك-ل-م-ن-ه*-و-ي
А-Б-В-Г-Д-Е-Ё-Ж-З-И-Й-К-Л-М-Н-О-П-*-С-Т-У-Ф-Х-Ц-Ч-Ш-Щ-Ъ-Ы-Ь-*-Ю-Я
а-б-в-г-д-е-ё-ж-з-и-й-к-л-м-н-о-п-р-с-т-у-ф-х-ц-ч-ш-щ-ъ-ы-ь-э-ю-я
ä-ö-ü-ß-Ä-Ö-Ü
--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 02-16-2009, 09:47 PM
Nils Kassube
 
Default Run script on USB thumb drive connection

Dotan Cohen wrote:
> 2009/2/17 Bill Moseley <moseley@hank.org>:
> > 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.
>
> I've not tried it, but have the script wait a bit:
> sleep 10

Or let the script mount the drive.


Nils

--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 02-16-2009, 09:52 PM
Bill Moseley
 
Default Run script on USB thumb drive connection

On Mon, Feb 16, 2009 at 11:47:32PM +0100, Nils Kassube wrote:
> Dotan Cohen wrote:
> > 2009/2/17 Bill Moseley <moseley@hank.org>:
> > > 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.
> >
> > I've not tried it, but have the script wait a bit:
> > sleep 10
>
> Or let the script mount the drive.

That's what I'm doing and it works fine. The Script is pretty
trivial, really.

It's still getting mounted by gnome (I assume) after the script runs.
That's the part I'm wondering about -- how to stop that from happening
for this specific thumb drive.

Thanks.

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


--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 02-16-2009, 11:25 PM
Cameron Hutchison
 
Default Run script on USB thumb drive connection

Bill Moseley <moseley@hank.org> writes:

>It's still getting mounted by gnome (I assume) after the script runs.
>That's the part I'm wondering about -- how to stop that from happening
>for this specific thumb drive.

I use the following to stop auto-mounting of my hot-swap backup hard
drives:

I have created the file /etc/hal/fdi/policy with the following contents:

Adjust the UUIDs for your case.

---8<---
<?xml version="1.0" encoding="UTF-8"?> <!-- -*- SGML -*- -->

<!--
System policy to not automount the backup disks.
-->
<deviceinfo version="0.2">

<!-- Backup disc 1 - Seagate ST3160811AS 7200.9 160GB -->
<device>
<match key="volume.uuid" string="854a1d9e-916d-46af-9ba3-ae0fab3644ab">
<merge key="volume.ignore" type="bool">true</merge>
</match>
</device>

<!-- Backup disc 2 - Seagate ST3160811AS 7200.9 160GB -->
<device>
<match key="volume.uuid" string="cd630507-37dd-46e8-9bdd-33fdbd0edf42">
<merge key="volume.ignore" type="bool">true</merge>
</match>
</device>

</deviceinfo>
---8<---



--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 02-25-2009, 01:58 PM
Bill Moseley
 
Default Run script on USB thumb drive connection

On Tue, Feb 17, 2009 at 12:25:40AM -0000, Cameron Hutchison wrote:
>
> I have created the file /etc/hal/fdi/policy with the following contents:
>
> Adjust the UUIDs for your case.
>
> ---8<---
> <?xml version="1.0" encoding="UTF-8"?> <!-- -*- SGML -*- -->
>
> <!--
> System policy to not automount the backup disks.
> -->
> <deviceinfo version="0.2">
>
> <!-- Backup disc 1 - Seagate ST3160811AS 7200.9 160GB -->
> <device>
> <match key="volume.uuid" string="854a1d9e-916d-46af-9ba3-ae0fab3644ab">
> <merge key="volume.ignore" type="bool">true</merge>
> </match>
> </device>

Thanks Cameron,

How do determine the UUID for the device?


Do you have any pointers to docs on this?

I've been looking over:

http://opensolaris.org/os/project/tamarack/hal_re.html

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


--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 02-25-2009, 04:28 PM
Leonard Chatagnier
 
Default Run script on USB thumb drive connection

--- On Wed, 2/25/09, Bill Moseley <moseley@hank.org> wrote:

> From: Bill Moseley <moseley@hank.org>
> Subject: Re: Run script on USB thumb drive connection
> To: "Ubuntu user technical support, not for general discussions" <ubuntu-users@lists.ubuntu.com>
> Date: Wednesday, February 25, 2009, 8:58 AM
> On Tue, Feb 17, 2009 at 12:25:40AM -0000, Cameron Hutchison
> wrote:
> >
> > I have created the file /etc/hal/fdi/policy with the
> following contents:
> >
> > Adjust the UUIDs for your case.
> >
> > ---8<---
> > <?xml version="1.0"
> encoding="UTF-8"?> <!-- -*- SGML -*- -->
> >
> > <!--
> > System policy to not automount the backup disks.
> > -->
> > <deviceinfo version="0.2">
> >
> > <!-- Backup disc 1 - Seagate ST3160811AS 7200.9
> 160GB -->
> > <device>
> > <match key="volume.uuid"
> string="854a1d9e-916d-46af-9ba3-ae0fab3644ab">
> > <merge key="volume.ignore"
> type="bool">true</merge>
> > </match>
> > </device>
>
> Thanks Cameron,
>
> How do determine the UUID for the device?
>
Make sure you have libblkid1 installed(at least that's the name in Intrepid) and then run from a CLI:

blkid /dev/<block ID name> usually sda(x) or hda(x) and the output will give it to you.


Leonard Chatagnier
lenc5570@sbcglobal.net



--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 

Thread Tools




All times are GMT. The time now is 09:04 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org