LinuxQuestions.org
Visit Jeremy's Blog.
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 02-07-2008, 01:11 AM   #1
ashikahamed
LQ Newbie
 
Registered: Jun 2007
Posts: 9

Rep: Reputation: 0
udev


When I use udev rules to execute a bash script it is executed more than once (7 times).Is there a way to stop it after the first time? I'm using ubuntu 7.10
 
Old 02-07-2008, 05:57 PM   #2
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,186

Rep: Reputation: 346Reputation: 346Reputation: 346Reputation: 346
Use the export command to export a flag, and abort execution if the flag exists. Something like this:
Code:
[ "$Script_run" = "yes" ] && exit 0
export Script_run=yes
Note that $Script_run should not be a standard shell variable that wuld be automatically set during the boot process.
 
Old 02-08-2008, 11:26 AM   #3
ashikahamed
LQ Newbie
 
Registered: Jun 2007
Posts: 9

Original Poster
Rep: Reputation: 0
udev

The device i`m try is a USB Infra red adapter.If i use a flag as you have said udev won't run that script again unless i restart the computer.
 
Old 02-08-2008, 11:59 AM   #4
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,186

Rep: Reputation: 346Reputation: 346Reputation: 346Reputation: 346
Yes, but that's what your first question asked. You wanted it to "stop after the first time." So, can you be clearer about what you're asking?

By the way, you don't have to reboot. Just have another script:
Code:
#!/bin/bash
unset -v Script_run
 
Old 02-11-2008, 12:26 AM   #5
ashikahamed
LQ Newbie
 
Registered: Jun 2007
Posts: 9

Original Poster
Rep: Reputation: 0
Re: Udev

Sorry for not being clear about my question.I did as you have instructed and now the script is run only once.Thank you.
 
  


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
udev hosler Slackware 10 08-12-2006 03:02 PM
slackware-current, udev 0.96, and custom udev rules not working rignes Slackware 6 08-10-2006 04:43 AM
Udev anyone? yanik Debian 5 01-05-2005 10:02 AM
Help with udev sls Debian 4 12-28-2004 03:06 PM
udev ... I think element Debian 4 05-27-2004 04:32 PM


All times are GMT -5. The time now is 03:59 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration