You are not logged in.
Pages: 1
My plan is to write a udev-rule that automatically starts a backup script as soon as I plugin a specific usb-harddrive.
For testing purposes I'm trying to run /usr/bin/gedit and create the symlink /dev/backup-drive
here's my rule:
## /etc/udev/rules.d/95-backup.rules
SUBSYSTEM=="usb", ATTRS{serial}=="100", SYMLINK="backup_drive", RUN+="/usr/bin/gedit"
The symlink works fine. However, gedit does not start.
What am I missing?
Last edited by mehldutt (2007-04-26 18:12:44)
Offline
is it a typo or are you missing the quotes at the end of the line?
whahaha... guess it was a type then...
Last edited by klixon (2007-04-25 22:42:01)
Stand back, intruder, or i'll blast you out of space! I am Klixon and I don't want any dealings with you human lifeforms. I'm a cyborg!
Offline
that was a typo in my message
Offline
here some more information:
# udevinfo -a -p $(udevinfo -q path -n /dev/sdb)
Udevinfo starts with the device specified by the devpath and then
walks up the chain of parent devices. It prints for every device
found, all possible attributes in the udev rules key format.
A rule to match, can be composed by the attributes of the device
and the attributes from one single parent device.
looking at device '/block/sdb':
KERNEL=="sdb"
SUBSYSTEM=="block"
DRIVER==""
ATTR{stat}==" 69 193 1022 352 14 4 144 68 0 332 420"
ATTR{size}=="156301488"
ATTR{removable}=="0"
ATTR{range}=="16"
ATTR{dev}=="8:16"
looking at parent device '/devices/pci0000:00/0000:00:1d.7/usb5/5-4/5-4:1.0/host2/target2:0:0/2:0:0:0':
KERNELS=="2:0:0:0"
SUBSYSTEMS=="scsi"
DRIVERS=="sd"
ATTRS{ioerr_cnt}=="0x0"
ATTRS{iodone_cnt}=="0x5a"
ATTRS{iorequest_cnt}=="0x5a"
ATTRS{iocounterbits}=="32"
ATTRS{timeout}=="30"
ATTRS{state}=="running"
ATTRS{rev}=="AD00"
ATTRS{model}=="MK8032GAX "
ATTRS{vendor}=="TOSHIBA "
ATTRS{scsi_level}=="3"
ATTRS{type}=="0"
ATTRS{queue_type}=="none"
ATTRS{queue_depth}=="1"
ATTRS{device_blocked}=="0"
ATTRS{max_sectors}=="240"
looking at parent device '/devices/pci0000:00/0000:00:1d.7/usb5/5-4/5-4:1.0/host2/target2:0:0':
KERNELS=="target2:0:0"
SUBSYSTEMS==""
DRIVERS==""
looking at parent device '/devices/pci0000:00/0000:00:1d.7/usb5/5-4/5-4:1.0/host2':
KERNELS=="host2"
SUBSYSTEMS==""
DRIVERS==""
looking at parent device '/devices/pci0000:00/0000:00:1d.7/usb5/5-4/5-4:1.0':
KERNELS=="5-4:1.0"
SUBSYSTEMS=="usb"
DRIVERS=="usb-storage"
ATTRS{interface}=="Mass Storage Class"
ATTRS{modalias}=="usb:v04CFp8818dB008dc00dsc00dp00ic08isc05ip50"
ATTRS{bInterfaceProtocol}=="50"
ATTRS{bInterfaceSubClass}=="05"
ATTRS{bInterfaceClass}=="08"
ATTRS{bNumEndpoints}=="02"
ATTRS{bAlternateSetting}==" 0"
ATTRS{bInterfaceNumber}=="00"
looking at parent device '/devices/pci0000:00/0000:00:1d.7/usb5/5-4':
KERNELS=="5-4"
SUBSYSTEMS=="usb"
DRIVERS=="usb"
ATTRS{serial}=="100"
ATTRS{product}=="USB Mass Storage Device"
ATTRS{manufacturer}=="Myson Century, Inc."
ATTRS{maxchild}=="0"
ATTRS{version}==" 2.00"
ATTRS{devnum}=="2"
ATTRS{speed}=="480"
ATTRS{bMaxPacketSize0}=="64"
ATTRS{bNumConfigurations}=="1"
ATTRS{bDeviceProtocol}=="00"
ATTRS{bDeviceSubClass}=="00"
ATTRS{bDeviceClass}=="00"
ATTRS{bcdDevice}=="b008"
ATTRS{idProduct}=="8818"
ATTRS{idVendor}=="04cf"
ATTRS{bMaxPower}==" 10mA"
ATTRS{bmAttributes}=="c0"
ATTRS{bConfigurationValue}=="1"
ATTRS{bNumInterfaces}==" 1"
ATTRS{configuration}=="USB Mass Storage"
looking at parent device '/devices/pci0000:00/0000:00:1d.7/usb5':
KERNELS=="usb5"
SUBSYSTEMS=="usb"
DRIVERS=="usb"
ATTRS{serial}=="0000:00:1d.7"
ATTRS{product}=="EHCI Host Controller"
ATTRS{manufacturer}=="Linux 2.6.20-ARCH ehci_hcd"
ATTRS{maxchild}=="8"
ATTRS{version}==" 2.00"
ATTRS{devnum}=="1"
ATTRS{speed}=="480"
ATTRS{bMaxPacketSize0}=="64"
ATTRS{bNumConfigurations}=="1"
ATTRS{bDeviceProtocol}=="01"
ATTRS{bDeviceSubClass}=="00"
ATTRS{bDeviceClass}=="09"
ATTRS{bcdDevice}=="0206"
ATTRS{idProduct}=="0000"
ATTRS{idVendor}=="0000"
ATTRS{bMaxPower}==" 0mA"
ATTRS{bmAttributes}=="e0"
ATTRS{bConfigurationValue}=="1"
ATTRS{bNumInterfaces}==" 1"
ATTRS{configuration}==""
looking at parent device '/devices/pci0000:00/0000:00:1d.7':
KERNELS=="0000:00:1d.7"
SUBSYSTEMS=="pci"
DRIVERS=="ehci_hcd"
ATTRS{msi_bus}==""
ATTRS{broken_parity_status}=="0"
ATTRS{enable}=="1"
ATTRS{modalias}=="pci:v00008086d0000265Csv0000144Dsd0000C01Ebc0Csc03i20"
ATTRS{local_cpus}=="f"
ATTRS{irq}=="19"
ATTRS{class}=="0x0c0320"
ATTRS{subsystem_device}=="0xc01e"
ATTRS{subsystem_vendor}=="0x144d"
ATTRS{device}=="0x265c"
ATTRS{vendor}=="0x8086"
looking at parent device '/devices/pci0000:00':
KERNELS=="pci0000:00"
SUBSYSTEMS==""
DRIVERS==""
Offline
You can't start gedit from udev because it will not know how to connect to the X server.
Try something else in RUN+= .. some app that's not interactive and doesn't require X.
Offline
Udev runs as root so it can't probably find any available X display. You can try running it as a user with su or sudo but I don't know if it will work. Also don't use "=". Use ":=" or "+=".
It would be also a good idea to format your backup device as vfat and use "flush" option in fstab for disk syncing to avoid data loss when you unplug it.
Last edited by lanrat (2007-04-26 14:36:57)
Offline
thanks so much .
Everything working now.
Gary
Offline
Pages: 1