LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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, 12: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, 04:57 PM   #2
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,187

Rep: Reputation: 354Reputation: 354Reputation: 354Reputation: 354
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, 10: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, 10:59 AM   #4
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,187

Rep: Reputation: 354Reputation: 354Reputation: 354Reputation: 354
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-10-2008, 11:26 PM   #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



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

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:40 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