It seems particularly strange that you need to run the script twice as you describe.
In your (now deleted) post, you seemed to indicate that setting the green to 0 turns it on and setting it to 1 turns it off... is this your finding? If so, that would indicate inverted logic.
Can you go back to the status of the green LED -- use the commands I provided earlier and just toggle it manually on the command line. Does it toggle as expected (1 = on, 0 = off, each command has the desired effect immediately)?
I'm really not sue why you are having issues here, except that it is possible that maybe there is another process that is actually configuring the LEDs that is completing around the same time or after your script runs.
Unlike originally intended, the rc.local is not run last any more.
It is run by the "done" init script that has priority 95 (S95done symlink).
LEDs have 96 as S96leds, and are configured after rc.local.
option hostname 'OpenWrt'
option timezone 'UTC'
option ttylogin '0'
option log_size '64'
option urandom_seed '0'
config timeserver 'ntp'
option enabled '1'
option enable_server '0'
list server '0.openwrt.pool.ntp.org'
list server '1.openwrt.pool.ntp.org'
list server '2.openwrt.pool.ntp.org'
list server '3.openwrt.pool.ntp.org'
should I put either code for the lights or the code to run the script in there?
If I followed along correctly and you can run the second command successfully manually after the router is up a while, try adding a longer time to the sleep statement in your startup script.
Try sleep 200 .
This idea was inspired by psherman's reply: