Jan 5, 2013

openSUSE Forums: Can't get figure out how to use udev to launch scripts!

openSUSE Forums
openSUSE Forums
Can't get figure out how to use udev to launch scripts!
Jan 5th 2013, 15:32

### Problem ###

I'm usually comfortable around my system but I've come across a problem that I just can't figure out. I have a server which runs headless that handles a samba share for the house. The only issue I have is that my brother occasionally unplugs the device. At first I just used to use an fstab entry but that only helps at boot time and isn't ideal as the system is occasionally booted without the hard drive. My idea is now to launch a script using udev rules mount the drive. I've been running into issues and have reduced my problem to as basic a form as is possible and am now testing it on my own system and I still can't solve it.

### My attempt ###

My first step was to create the file /etc/udev/rules.d/03-mountNex.rules:
Code:

ERNEL=="sdc", ACTION=="add", RUN+="/home/daniel/script"
This should launch the script "/home/daniel/script" when I plug in a third hard drive.

The script itself is for now rudimentary:
Code:

#! /usr/bin/sh
/usr/bin/dolphin

The script just opens up an instance of dolphin. Nothing fancy.

I now restart my computer with the device not plugged in. Login in and then plug the device in.

Some other useful info is my permissions on the udev file and script:

Code:

daniel@linux-w365:/etc/udev/rules.d> ls -l
total 292
-rw-r--r-- 1 root root    57 Jan  5 16:36 03-mountNex.rules
........


Code:

ls -l                                                                                                         
total 17400                                                                                                                         
........
-rwxr-xr-x  1 daniel users          32 Jan  5 16:28 script
........

### Intended Result ###
When I plug the device in then dolphin should launch

### Actual Result ###
Absolutely nothing happens except the normal KDE dialog pop-ups asking what I want to do with the drive.

### Suspected issue ###
Something to do with permissions but I'm not sure.

### System Info ###
openSUSE 12.2 with KR49 repo.

Thanks a ton for any help you can provide.

You are receiving this email because you subscribed to this feed at blogtrottr.com.

If you no longer wish to receive these emails, you can unsubscribe from this feed, or manage all your subscriptions

No comments: