LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-29-2011, 01:08 AM   #1
vinaytp
Member
 
Registered: Apr 2009
Location: Bengaluru, India
Distribution: RHEL 5.4, 6.0, Ubuntu 10.04
Posts: 704

Rep: Reputation: 55
udev rule to invoke a script


Dear All,

I am not good at writing udev rules. I am using RHEL 4.7, I would like to invoke a file install.sh which is in CDROM as soon as the CDROM is inserted.

How to go about it ?

Thanks
 
Old 03-29-2011, 06:54 AM   #2
easuter
Member
 
Registered: Dec 2005
Location: Portugal
Distribution: Slackware64 13.0, Slackware64 13.1
Posts: 538

Rep: Reputation: 62
Hi,

I'm not sure that what you want to do is possible with a cdrom drive (but I may be wrong). CD drives, as far as I know, don't notify the operating system when the drive has been opened or closed, it's the operating system that has to continually poll the drive to see if anything has happened (on Linux this is what HAL does).

What you want to do is possible in the case of USB storage devices since plugging in a USB device generates a UDEV event that the OS can catch; VectorLinux uses this method to automount pen-drives (see http://code.google.com/p/vl-hot/).

Perhaps you may have more luck reading HAL's documentation, it might be possible to create a policy that can do what you need (see here for some examples on creating policies: https://wiki.archlinux.org/index.php/HAL).

Hope this helps.

Last edited by easuter; 03-29-2011 at 06:56 AM.
 
Old 03-29-2011, 07:35 AM   #3
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670
Ubuntu utilizes an autorun feature for CDROMs, which might provide a model. However I would like you to consider not doing this at all. Auto-run is extremely dangerous. About as dangerous as being a snake charmer. You are trying to add autorun to a linux distro, when MS is removing that feature. That should tell you something.

Also, an install script should not be launched from a udev rule. Scripts launched with RUN+= need to be short and quick.
Since they run in the background, the install script can't expect input or print output unless it's to a log file, or using "logger".
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Help writing a Udev rule niknak Linux - Newbie 1 12-09-2009 09:22 PM
First UDEV Rule, Not quite there ... orbit Slackware 7 02-22-2009 11:08 PM
udev rule: need help DPenguin Linux - Hardware 0 08-04-2008 08:29 PM
Udev Rule Help Please Toods Slackware 1 11-23-2007 09:55 AM
need help with udev rule hussam Linux - Software 2 12-05-2006 04:30 AM


All times are GMT -5. The time now is 09:08 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration