From mboxrd@z Thu Jan 1 00:00:00 1970 From: Clemens Koller Date: Fri, 18 Nov 2005 16:00:28 +0000 Subject: Re: hot-plugged USB Harddisk executes backup script in /etc/hotplug/usb Message-Id: <437DFA9C.4050606@anagramm.de> List-Id: References: <437CBC28.3040008@anagramm.de> In-Reply-To: <437CBC28.3040008@anagramm.de> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: linux-hotplug@vger.kernel.org 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_id845&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