Maybe the stuff isn't yet completely initialized when your script is run?
I'm trying to add a script with root privileges to my startup that disables the wifi led:
Running the script from terminal works, led is off.Code:sudo echo none > /sys/class/leds/iwl-phy0::RX/trigger sudo echo none > /sys/class/leds/iwl-phy0::TX/trigger sudo echo none > /sys/class/leds/iwl-phy0::radio/trigger sudo echo none > /sys/class/leds/iwl-phy0::assoc/trigger
I've tried adding the script to init.d & running update-rc.d, tried using visudo & adding the script to my startup applications. Nothing is working.
Anyone have any ideas?
I'm using ubuntu 9.10.
Maybe the stuff isn't yet completely initialized when your script is run?
Wouldn't it be simpler to change the driver an add an option for that?
If it's run from init.d it'll be run as root, so you don't need the "sudo"s. Also, it needs to be an executable script, what you've posted there is just a bunch of commands that need to be "sourced" from a shell that's already running. To make it a script that can be run from init.d. add:
To the VERY TOP of the file (first line), then make sure the file's permissions allow execution (chmod a+x ledscript)Code:#!/bin/sh
Then make sure it's in /etc/init.d, and that it makes it into /etc/rc2.d once you run update-rc.d
Actually, an easier way would be to just add the commands to /etc/rc.local (above the last line which is "exit 0") - rc.local is basically designed for this sort of custom stuff.
You can execute scripts on load of a module too.
I added #!/bin/sh, removed the sudo's, tried adding to rc.local, tried adding to init.d to be run last...
rc.local kinda worked...for 3 seconds & then the leds came back, so something is triggering the leds even after the script is run.
I tried rmmod led_class just for kicks & sure enough the leds came back on when iwl3945 module was reloaded. Maybe something in iwl3945 is triggering the leds?
All I can think is to have the script load after everything else is done, but adding it to startup applications & editing sudoers & even adding a sleep 10 doesn't work. The script just isn't being executed.
sudo won't even work there, since all it does is run echo as root and then redirect the output as the current user.