luci-app-networking_monitor的OpenWrt页面制作
来源:互联网 发布:2017成都 网络视听大会 编辑:程序博客网 时间:2024/06/06 18:07
在网上找了一圈,也没有找到联网监测的OpenWrt页面,于是自己动手写了个luci-app-networking_monitor。
将luci-app-networking_monitor目录放到OpenWrt源码的package/utils下:
[xujun@localhost luci-app-networking_monitor]$ tree.├── files│ └── root│ ├── etc│ │ ├── config│ │ │ └── networking_monitor│ │ └── init.d│ │ └── networking_monitor│ └── usr│ └── lib│ └── lua│ └── luci│ ├── controller│ │ └── networking_monitor.lua│ └── model│ └── cbi│ └── networking_monitor.lua└── Makefile12 directories, 5 files[xujun@localhost luci-app-networking_monitor]$
luci-app-networking_monitor/Makefile
include $(TOPDIR)/rules.mkPKG_NAME:=luci-app-networking_monitorPKG_VERSION=1.0PKG_RELEASE:=1PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)include $(INCLUDE_DIR)/package.mkdefine Package/luci-app-networking_monitorSECTION:=luciCATEGORY:=LuCISUBMENU:=3. ApplicationsTITLE:=NETWORK MONITOR for LuCIPKGARCH:=allendefdefine Package/luci-app-networking_monitor/descriptionThis package contains LuCI configuration pages for network monitor.endefdefine Build/Prepareendefdefine Build/Configureendefdefine Build/Compileendefdefine Package/luci-app-networking_monitor/install$(INSTALL_DIR) $(1)/etc/config$(INSTALL_DIR) $(1)/etc/init.d$(INSTALL_DIR) $(1)/usr/lib/lua/luci/model/cbi$(INSTALL_DIR) $(1)/usr/lib/lua/luci/controller$(INSTALL_CONF) ./files/root/etc/config/networking_monitor $(1)/etc/config/networking_monitor$(INSTALL_BIN) ./files/root/etc/init.d/networking_monitor $(1)/etc/init.d/networking_monitor$(INSTALL_DATA) ./files/root/usr/lib/lua/luci/model/cbi/networking_monitor.lua $(1)/usr/lib/lua/luci/model/cbi/networking_monitor.lua$(INSTALL_DATA) ./files/root/usr/lib/lua/luci/controller/networking_monitor.lua $(1)/usr/lib/lua/luci/controller/networking_monitor.luaendef$(eval $(call BuildPackage,luci-app-networking_monitor))
luci-app-networking_monitor/files/root/etc/config
config login#option enable '1'option minute '10'option domain '114.114.114.114'
luci-app-networking_monitor/files/root/etc/init.d
#!/bin/sh /etc/rc.commonSTART=50networking_monitor(){local enableconfig_get_bool enable $1 enableif [ $enable ]; thenlocal minutelocal domainconfig_get minute $1 minuteconfig_get domain $1 domaincrontab -rcat /tmp/reply_message.cron >>/etc/crontabs/rootecho "*/$minute * * * * /bin/sh /etc/networking_monitor.sh $domain &" >>/etc/crontabs/rootecho "network monitor has started."/etc/init.d/cron restartelsecrontab -rcat /tmp/reply_message.cron >>/etc/crontabs/rootecho "network monitor has started."/etc/init.d/cron restartfi}start(){config_load networking_monitorconfig_foreach networking_monitor login}stop(){echo "network monitor has stoped."}
luci-app-networking_monitor/files/root/usr/lib/lua/luci/controller
module("luci.controller.networking_monitor", package.seeall)function index() entry({"admin", "network", "ping_Monitor"}, cbi("networking_monitor"), _("联网监测"), 101) end
luci-app-networking_monitor/files/root/usr/lib/lua/luci/model/cbi/networking_monitor.lua
--[[LuCI - Lua Configuration InterfaceCopyright 2010 Jo-Philipp Wich <xm@subsignal.org>Licensed under the Apache License, Version 2.0 (the "License");you may not use this file except in compliance with the License.You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0]]--require("luci.sys")m = Map("networking_monitor", translate("联网监测"), translate("配置联网监测。"))s = m:section(TypedSection, "login", "")s.addremove = falses.anonymous = trueenable = s:option(Flag, "enable", translate("Enable"))pass = s:option(Value, "minute", translate("分"), translate("每隔一段时间执行一次联网监测程序。"))--pass:depends("enable", "1")pass.rmempty = falsepass.default = "10"domain = s:option(Value, "domain", translate("ip地址或域名"))--domain:depends("enable", "1")domain.rmempty = falsedomain.default = "114.114.114.114"local apply = luci.http.formvalue("cbi.apply")if apply thenio.popen("/etc/init.d/networking_monitor restart")endreturn m
最后make menuconfig,可看到luci-app-networking_monitor。
0 0
- luci-app-networking_monitor的OpenWrt页面制作
- luci-app-ser2net的OpenWrt页面制作
- openwrt安装luci-app-pbx后无LUCI界面的解决方法
- OpenWrt添加LuCI的模块
- Openwrt中luci配置页面cbi小记
- OpenWrt自定义luci页面来修改配置文件
- openwrt luci
- openwrt 为你的固件添加luci aria2设置页面
- 开发OpenWrt路由器上LuCI的模块
- 开发OpenWrt路由器上LuCI的模块
- 开发OpenWrt路由器上LuCI的模块+++
- openwrt luci管理的Web界面实例
- OpenWrt路由器上的LuCI模块开发
- OpenWRT Luci界面的简单删改
- [OpenWrt] 修改openwrt的配置界面luci的方法
- [OpenWrt] openwrt编译过程(luci)
- [OpenWrt] openwrt编译过程(luci)
- [OpenWrt] openwrt编译过程(luci)
- 【基础编程】hdu题目分类
- Java中Super与This关键字的区分
- Thrift连接池优化
- GearLoadingProject
- OpenCV HOGDescriptor 参数图解
- luci-app-networking_monitor的OpenWrt页面制作
- getCurrentSession 与 openSession() 的区别
- PhoneWindow$DecorView{31e4dedf V.E..... R......D 0,0-377,80} not attached to window manager
- 8.1 自定义 Git - 配置 Git
- flume从kafka导数据到hdfs
- 禁止scroll布局变化后自动滚动
- JQuery Validate-更改错误显示位置
- CMD UFT-8编码格式
- 欢迎使用CSDN-markdown编辑器