I have added a global vlans (not switch vlans) page to luci intended to set vlans on the ethernet, wireless and localhost interfaces. The page interfaces ok with the uci /etc/config/vlans file. Now I need to have the luci save&apply trigger a function in the /etc/init.d/vlans file which will use ip commends to actually set the vlans on the interfaces. I think I've read that my init.d file needs to have a
service_triggers function containing the line
procd_add_reload_trigger "vlans"
a function, not sure of the name, which does the ip commands
Nothing seems to happen when the luci save&apply button is clicked, though.
The init script is loaded when
config vlans
option init vlans
is added to ucitrack.
Thanks. I do have a script /etc/init.d/vlans. The trouble I was having was in getting this script triggered when the Save&Apply button was pressed. I eventually went for an old-fashioned
m = Map("vlans", translate("VLANs"), translate(""))_
function m.on_commit(map)_
m.description = "on_commit"_
luci.sys.call("/etc/init.d/network restart")_
end
from the luci map, which does invoke a network restart.
Now the challenge is to navigate the restart process to integrate the vlan setup from the /etc/config/vlans uci file.
Having trouble there, though, so I'll go back to my init script and see if i can tweak the running network
Hi @enjay77
I'm looking for like you, "getting this script triggered when the Save&Apply button was pressed".I want to start or stop a script based on a value or a checkbox on my Luci page .
If you have something which can help me
Thanks
I only have my script triggered when the Save&Apply button is pressed.
Sorry, I don't know how to start or stop a script based on a value or a checkbox.