Luci-app-commands configuration file

I am using luci-app-commands without an issue.
But every time I reinstall Openwrt. I must re-configure all commands.
Also, i have to repeat all configuration on all other routers.

Is there a configuration file option available?
The idea is to simple copy configuration file and luci-app-commands show all custom commands in dashboard.
Or we can use some uci syntax to configure luci-app-commands?

Give an example of using UCI

Isn't the configuration saved in /etc/config/luci ?

1 Like

Usually it is.
Example from my own config...

root@router1:~# cat /etc/config/luci

config core 'main'
        option lang 'auto'
        option resourcebase '/luci-static/resources'
        option ubuspath '/ubus/'
        option mediaurlbase '/luci-static/bootstrap'
...

config command
        option name 'Backup LuCI stats'
        option command '/etc/storeStats.sh'

config command
        option name 'Restore LuCI stats backup'
        option command '/etc/restoreStats.sh'

1 Like

Thanks for your help, but this is not what I need. You can describe the same thing, but using UCI commands. This is necessary for the custom initialization script "etc\uci-defaults\99_userconfig"

#!/bin/sh
uci set wireless.@wifi-device[0].disabled="0"
uci set wireless.@wifi-iface[0].disabled="0"
uci set wireless.@wifi-iface[0].key="12345678"
uci set wireless.@wifi-iface[0].encryption="psk2"
uci commit wireless
exit 0

Well, I i gave you the uci config file syntax...
No idea that that you were looking for uci commands instead.

You can "show" the current config if you first setup one manually and then check the commands.

You can see the command item syntax for uci set below.

OpenWrt SNAPSHOT, r21922-6e428a8490
 -----------------------------------------------------
root@router1:~# uci show luci
luci.main=core
luci.main.lang='auto'
luci.main.resourcebase='/luci-static/resources'
...
luci.diag.ping='openwrt.org'
luci.diag.route='openwrt.org'
luci.@command[0]=command
luci.@command[0].name='Backup LuCI stats'
luci.@command[0].command='/etc/storeStats.sh'
luci.@command[1]=command
luci.@command[1].name='Restore LuCI stats backup'
luci.@command[1].command='/etc/restoreStats.sh'
root@router1:~#
3 Likes
#!/bin/sh

uci add luci command
uci set luci.@command[-1].name="Usb Power"
uci set luci.@command[-1].command='/tmp/usrcmd/usb.sh'
uci commit luci

exit 0

Don't save files in /tmp , they are erased on every reboot.

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.