⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 updown.lua

📁 嵌入式无线路由系统openwrt的web配置工具
💻 LUA
字号:
#!/usr/bin/lua-- Copyright (C) 2008 OpenRB.comrequire('fslib')data = datajson() or {}-- check that ifname ('id' param) is suppliedif (data['id'] ~= nil) then  ifname = data['id']  -- check status  ifnames = proc('if-json -s')  up = (ifnames[ifname] == 1 and true or false)  -- convert ifname to uci config, ignore bridges  if ifname:find('^br--') ~= nil or ifname:find('^bond') ~= nil then    cfgname = nil  else    cfgname = iftocfg(ifname)  end  if (cfgname ~= nil) then    -- uci config is found, use built-in command    cmd = (up == true and 'ifdown ' .. cfgname or 'ifup ' .. cfgname)  else    -- otherwise, use ifconfig    cmd = 'ifconfig ' .. ifname .. (up == true and ' down' or ' up')  end  -- switch interface state  os.execute(cmd)end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -