LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat
User Name
Password
Red Hat This forum is for the discussion of Red Hat Linux.

Notices


Reply
  Search this Thread
Old 07-10-2008, 11:50 PM   #1
ukrishnanps
LQ Newbie
 
Registered: Jul 2008
Posts: 7

Rep: Reputation: 0
problem with UDEV rules


Hi ,
i wrote a new rule for detecting a USB drive(thump drive) connected and automatically create a file in USB drive connected. The rule which i wrote is given below.

KERNEL="sd[a-z][0-9]",SYMLINK="My_USB",RUN+="/usr/bin/script.sh"

when i connected the USB drive, the symbolic name got created . but the script is not getting executed.

The script i wrote is as follows.

#!/bin/sh
echo "Hii"
mount /dev/My_USB usb
cd usb
touch ff.txt
cd ..
umount /dev/My_USB


Why 'RUN+' command is not working...? is there any problem in my script file? If i am running this script seperately it's working fine.

I am using RED HAT enterprise edition 4 and kernal version 2.6.20.14

Please help...
 
Old 07-11-2008, 12:49 AM   #2
Vit77
Member
 
Registered: Jun 2008
Location: Toronto, Canada
Distribution: SuSE, RHEL, Mageia
Posts: 132

Rep: Reputation: 17
Are there SerialATA or SCSI hard drives in your box?
It could be the reason, because My_USB became a link to the HDD already.
 
Old 07-11-2008, 01:10 AM   #3
ukrishnanps
LQ Newbie
 
Registered: Jul 2008
Posts: 7

Original Poster
Rep: Reputation: 0
i have SCSI hard disk in my system .. I am able to create the symbolic name My_USB and if i am running the script seperately, i am able to perform the operation using the same symbolic link. That means link is created properly right? Only when i am trying to invoke the script through RUN+=RUN+="/usr/bin/script.sh", the required action is not taking place.
 
Old 07-11-2008, 01:22 AM   #4
pinniped
Senior Member
 
Registered: May 2008
Location: planet earth
Distribution: Debian
Posts: 1,732

Rep: Reputation: 50
How do you know your script isn't being executed? You are not recording any information in a meaningful way (stdout is redirected to /dev/null). Try touching a file in '/tmp' or something to give you an indication of what's happening.
 
Old 07-11-2008, 01:59 AM   #5
ukrishnanps
LQ Newbie
 
Registered: Jul 2008
Posts: 7

Original Poster
Rep: Reputation: 0
Problem with UDEV rules

Quote:
Originally Posted by pinniped View Post
How do you know your script isn't being executed? You are not recording any information in a meaningful way (stdout is redirected to /dev/null). Try touching a file in '/tmp' or something to give you an indication of what's happening.
when i am running the script seperately after creating a symbolic link for USB drive, the required file is getting created in the USB drive(thump drive). But if i am trying to execute the script using the RUN+= option in the UDEV rule, the file is not getting created in the USB drive. from this i concluded that the script is not getting executed if i am tring with UDEV RUN+= option.
 
Old 07-14-2008, 03:09 AM   #6
JZL240I-U
Senior Member
 
Registered: Apr 2003
Location: Germany
Distribution: openSuSE Tumbleweed-KDE, Mint 21, MX-21, Manjaro
Posts: 4,629

Rep: Reputation: Disabled
As Vit77 already wrote, udev doesn't like double links. I'd suggest to try the script from the udev rule without the "mount" and "umount" commands.
 
  


Reply



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
Problem in UDEV rules ukrishnanps Linux - Software 1 07-11-2008 12:01 AM
Udev rules... Very Frustrating binarybob0001 Linux - Software 9 06-05-2007 07:06 PM
slackware-current, udev 0.96, and custom udev rules not working rignes Slackware 6 08-10-2006 03:43 AM
Udev rules working but... cferron Linux - Hardware 5 03-24-2006 02:46 AM
need help fixing my udev rules or ivman rules hedpe Linux - Hardware 2 03-18-2006 10:07 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat

All times are GMT -5. The time now is 06:06 PM.

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
Open Source Consulting | Domain Registration