Rc.local can't run

I'm trying to turn off the green led after startup like below:

put

./root/green-led-off.sh &

into rc.local

the green-led-off.sh as below:

#!/bin/sh
#
/bin/echo "0" > /sys/devices/platform/leds-gpio/leds/d-link:green:power/brightness

and i also have tried

/root/green-led-off.sh

none works.

what's the correct method to turn off the green led on startup?

This can usually be done with the existing LED control in /etc/config/system.

Is an error message shown in the second case?
Didd you set execute permission (chmod -x) the script file?

2 Likes

To test/troubleshoot any automatic scripts (such as rc.local), I often do a super simple operation like creating a file. So maybe something like:

touch /root/rclocal_works.txt

If that is placed a the first active line of the script and it works, I'll do something similar farther down the file... this helps me understand if rc.local is running at all and/or if it is getting hung up on something I've got in the body of the script. If it runs and creates the files but the part of the script I care about didn't work, it points to an issue with the command(s) (or permissions for an executed script), or possibly reveals that there is some other issue (such as some other process taking control over the thing I'm trying to do).

yeah, the script file has +x permission.

it's a good idea.