LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   udev (https://www.linuxquestions.org/questions/linux-newbie-8/udev-619252/)

ashikahamed 02-07-2008 12:11 AM

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

PTrenholme 02-07-2008 04:57 PM

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.

ashikahamed 02-08-2008 10:26 AM

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.

PTrenholme 02-08-2008 10:59 AM

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


ashikahamed 02-10-2008 11:26 PM

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.


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