Luci Custom Commands (via luci-app-commands) - how to run multiple commands?

I need to execute from Luci custom commands the following:

uci set wireless.default_radio0.network='lan'
uci commit

This does not work: uci set wireless.default_radio0.network='lan' && uci commit

'uci' 'set' 'wireless.default_radio0.network=lan' '&&' 'uci' 'commit'

Usage: uci [] []

Commands:
batch
export []
import []
changes []
commit []
add
add_list ..=
del_list ..=
show [[.[.]]]
get .[.]
set .[.]=
delete [.[[.][=]]]
rename .[.]=
revert [.[.]]
reorder .=

Use SSH or Putty to connect to your router and use the command line.

1 Like

That's the default setting. Are you experiencing some issue?

You execute commands from the Command Line - not the web GUI (i.e. LuCI).

You can use a package called luci-app-commands, which lets you run scripts from the luci web interface.

2 Likes

I should have been more clear: I'm using luci-app-commands which adds custom commands menu. (I updated the title)

My question is how can I execute multiple commands though this app.

@egc The idea is that I will create a shortcut on my phone and execute shell commands through the shortcut. @lleachii This is just an example.

The easiest way is to craft a shell script containing the multiple commands, save it somewhere, e.g. /etc
And then use LuCI commands just to launch that script

2 Likes

Thanks, that is my fallback plan. I'm hoping for a solution that does not require shell and allows me to change commands from GUI as well.

I could probably create a bash script that executes a command that is passed via argument from the luci-app-commands, however this would be too insecure.

EDIT: I guess for now, I'll have a separate UCI COMMIT button which I'll run after executing single UCI command.

Try this:

/bin/sh -c "uci set wireless.default_radio0.network='lan' && uci commit"
3 Likes
/bin/sh -c "uci set wireless.default_radio0.network='lan' && uci commit"

works! Thank you.

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