找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
广告投放联系QQ68610888
查看: 2931|回复: 4

请问大神们 luci web页面中怎么添加一个按钮点击执行命令?

[复制链接]
luci web页面中怎么添加一个按钮点击后执行以下命令执行命令?

luci.sys.call("/etc/init.d/network restart  >/dev/null")

我的恩山、我的无线 The best wifi forum is right here.
不懂,帮顶
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

在model中的lua中实现on_after_commit接口
function m.on_after_commit(self)
        os.execute("/etc/init.d/network restart  >/dev/null");
end

也可以实现其他相关函数,如

--on_cancel        The user pressed cancel within a multi-step Delegator or a SimpleForm instance
--on_init        The CBI is about to render the Map object
--on_parse        The CBI is about to read received HTTP form values
--on_save, on_before_save        The CBI is about to save modified UCI configuration files
--on_after_save        Modified UCI configuration files just got saved
--on_before_commit        The CBI is about to commit the changes
--on_commit, on_after_commit, on_before_apply        Modified configurations got committed and the CBI is about to restart associated services
--on_apply, on_after_apply        All changes where completely applied (only works on Map instances with the apply_on_parse attribute set)

我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| | 显示全部楼层
derry 发表于 2019-3-26 08:36
在model中的lua中实现on_after_commit接口
function m.on_after_commit(self)
        os.execute("/etc/init.d/ ...

十分感谢,看您这例子懂了
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

luci并不支持非配置的按钮,html可以,剩下的就是上面说的用apply来触发了
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

有疑问请添加管理员QQ86788181|手机版|小黑屋|Archiver|恩山无线论坛(常州市恩山计算机开发有限公司版权所有) ( 苏ICP备05084872号 )

GMT+8, 2024-4-28 02:23

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

| 江苏省互联网有害信息举报中心 举报信箱:js12377 | @jischina.com.cn 举报电话:025-88802724 本站不良内容举报信箱:68610888@qq.com 举报电话:0519-86695797

快速回复 返回顶部 返回列表