You are not logged in.

#1 2010-09-12 09:24:25

hashiru
Member
Registered: 2010-06-06
Posts: 7

[SOLVED] udev calling script twice when using KERNEL==

I am currently having trouble with a udev-rule.

At first I wrote a rule with ATTRS{size} and the external HDDs serial number, and everything worked fine (my script was called once), but as this seemed to quick&dirty to me, I wanted to use the partition number and the serial (+vendor and productId) instead. However now, udev is calling my script twice which leads to an error at the first instance (as the device is not yet attached by udev). It seems that udev ignores the partition number…

My rule looks like this (new line insert for readibility):

SUBSYSTEMS=="usb", KERNEL=="sd?1", ATTRS{idVendor}=="1058", ATTRS{idProduct}=="1001",
ATTRS{serial}=="574D41535932313539383436", RUN+="/root/backup-to-external.sh"

The working rule looked like this (new line insert for readibility):

SUBSYSTEMS=="usb", ATTRS{serial}=="574D41535932313539383436",
ATTR{size}=="1250261680", RUN+="/root/backup-to-external.sh"

and udevadm output is this: http://pastebin.com/raTRP4Y5

Of course I could just let my script check if the device is really attached (so that the first call would not be proceeded), but this would be as dirty as using ATTRS{size} in my eyes…


[EDIT]
It seems to be working now. The only thing I changed was, that I did a reboot this night. Maybe udev still had the old rule in cache and thus called both (even though the old one was marked as comment)? I would love to give a real solution, but the only thing I can say is that I did a reboot and now there is only one new line in my log.

Last edited by hashiru (2010-09-13 20:39:00)


my basic setup: openbox | pypanel | urxvt

http://stefan-koch.name/

Offline

Board footer

Powered by FluxBB