I'm changing the LED configuration to reduce their flashing in the night while still providing their normal functionality at day. To do this I have written a short script which is run twice a day and I want to improve it to avoid writing the settings to flash to reduce wear on the ROM-chip.
#!/bin/sh
if [ "$1" == "on" ]; then
uci set system.led_wlan.trigger='phy0tpt'
uci set system.led_wan.trigger='netdev'
uci set system.led_lan.trigger='netdev'
uci set system.@led[3].sysfs='amber:info'
uci set system.@led[3].trigger='heartbeat'
uci set system.@led[4].trigger='none'
uci set system.@led[4].default='1'
uci commit
/etc/init.d/led restart
echo "Switch on"
elif [ "$1" == "off" ]; then
leds='led_wan led_wlan led_lan @led[3] @led[4]'
for i in $leds ;
do
uci set "system.$i.trigger"="none"
uci set "system.$i.default"="0"
done
uci set system.@led[3].sysfs='red:info'
uci set system.@led[3].default='1'
uci commit
/etc/init.d/led restart
echo "Switch off"
else
echo "Unknown parameter"
fi
Now I know that I can do some modifications in /sys/class/leds/, but I haven't figured out how those uci-commands map to those files (and whether they will still write to flash). I can switch leds on or off by setting brightness, but if then the trigger gets reset and I cannot find a way to write to trigger.
Is there some way to apply those changes (or similar) without a need to write to flash?
Nice this works now except for writing 1 to link when using netdev (which exists normally and could be enabled in the GUI). But it still works for me fine and for anyone interested here is the resulting file: