All of lore.kernel.org
 help / color / mirror / Atom feed
From: Clemens Koller <clemens.koller@anagramm.de>
To: linux-hotplug@vger.kernel.org
Subject: Re: hot-plugged USB Harddisk executes backup script in /etc/hotplug/usb
Date: Fri, 18 Nov 2005 16:00:28 +0000	[thread overview]
Message-ID: <437DFA9C.4050606@anagramm.de> (raw)
In-Reply-To: <437CBC28.3040008@anagramm.de>

Hello, Kay!

>>Whenever I plug (turn on) the external harddisk, udevmonitor shows me
>>nice events and my script is called. But it's called TWICE at the same
>>time which leads to mount conflicts and other strange things.
>>If I call my backup script manually, it works fine.
>
> There was no change regarding this, you always get multiple events for
> different parts of that device and need to act only on one of them.

Hmm, okay. What are the different parts of my device?
I can imagine that I get a "part" for the blue OneTouch Button and
a "part" for the harddisk itself, but if I have a look at the logs
(see my old mail) it says: that there is some code executed
twice "kernel: SCSI device sda: ..."
Well, it's simple miss-leading and therefore a bug in the kernel
or scsi.agent. 8-P

> You
> can probably look if $INTERFACE, or something else, only for one of the
> events is set in the environment, else just exit. "udevmonitor --env"
> should show the difference.
> Anyway, you better move to udev rules to hook into the events, instead
> of depending on the weird map stuff, which is not longer supported.

Okay, I removed my stuff from usb.usermap and added a
/etc/udev/rules.d/10-local.rules
containing

# /etc/udev/rules/10-local.rules - my udev device naming rules
BUS="usb", KERNEL="sda3", ACTION="add", SYSFS(Manufacturer)="Maxtor*", SYSFS(serial)="A82T450E*", SYMLINK+="backup_disc", RUN="/etc/backup/anabackup"

(I guess that the trailing spaces after Manufacturer or the serial are
ignored and I can write "Maxtor" and "A82T450E" without the asterisks, right?)

The interesting thing was, that if I add KERNEL="sd*" or KERNEL="sda", I get
my script called three(!) times at the same time!
I guess that this means that the rule gets hit for each
partition (sda1..sda3) from that disk and I have to narrow it down
to "sda3" which is my actual backup partition.

I expected that if I see the SYSFS(Manufacturer) and SYSFS(serial) only _once_
in the udevmonitor --env output, that I get the rule activated only
once, too.
Is that normal behaviour?
What's the reason for that behaviour?
What is scsi_devfs.sh intended to do there?

Another little problem was, that I was missing some documentation
in the udevd or udev or udevcontrol man page that udevd detects
changes in the rules-file automagically and that it's not
necessary to send it a signal as i.e. needed by samba to reload
it's configs.

Well, it works now! My five cents...
Thanks!

-- 
Clemens Koller
_______________________________
R&D Imaging Devices
Anagramm GmbH
Rupert-Mayer-Str. 45/1
81379 Muenchen
Germany

http://www.anagramm.de
Phone: +49-89-741518-50
Fax: +49-89-741518-19


-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.  Get Certified Today
Register for a JBoss Training Course.  Free Certification Exam
for All Training Attendees Through End of 2005. For more info visit:
http://ads.osdn.com/?ad_idv28&alloc_id\x16845&op=click
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

      parent reply	other threads:[~2005-11-18 16:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-17 17:21 hot-plugged USB Harddisk executes backup script in /etc/hotplug/usb Clemens Koller
2005-11-17 21:09 ` hot-plugged USB Harddisk executes backup script in /etc/hotplug/usb twice Kay Sievers
2005-11-18 16:00 ` Clemens Koller [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=437DFA9C.4050606@anagramm.de \
    --to=clemens.koller@anagramm.de \
    --cc=linux-hotplug@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.